/*
 * Copyright ©2026 Soham Pardeshi. All rights reserved.
 * Permission is hereby granted to students registered for University of
 * Washington CSE 333 for use solely during Summer Quarter 2026 for
 * purposes of the course. No other use, copying, distribution, or
 * modification is permitted without prior written consent. Copyrights
 * for third-party components of this work must be honored. Instructors
 * interested in reusing these course materials should contact the author.
 */

#ifndef PAIR_H_
#define PAIR_H_

// A class template holding two values of the same type (slides 48-49).
// Every method is inline, so the whole class is part of the template and
// lives in the header.
template <typename T>
class Pair {
 public:
  Pair(const T& a, const T& b) : first_(a), second_(b) {}

  T First() const { return first_; }
  T Second() const { return second_; }

  // Swap the two members in place.
  void Swap() {
    T t = first_;
    first_ = second_;
    second_ = t;
  }

 private:
  T first_, second_;  // members have the parameter type
};

#endif  // PAIR_H_