/**************************************************************************\ MODULE: pair SUMMARY: Pair templates. The decalaration Pair p; creates a pair object using the default constructors for S and T. The member p.a is the first component (of type S) and the member p.b is the second component (of type T). \**************************************************************************/ #include template class Pair { public: S a; T b; Pair(); // default constructor...invokes default constructors for S and T Pair(const S& x, const T& y); // initialize with (x, y) ~Pair(); // destructor...invokes destructors for S and T // defaut copy and move constructors and assignment }; template Pair cons(const S& x, const T& y); // returns Pair(x, y) /**************************************************************************\ Input/Output The I/O format for a Pair is [a b] \**************************************************************************/ template istream& operator>>(istream&, Pair&); template ostream& operator<<(ostream&, const Pair&); /**************************************************************************\ Equality Testing \**************************************************************************/ template long operator==(const Pair& x, const Pair& y); template long operator!=(const Pair& x, const Pair& y);