#ifndef PAIR_H_ #define PAIR_H_ #include // class template definition has the template // parameter ("Thing") in scope throughout template class Pair { public: Pair() { }; // default constructor still initializes data members const Thing& first() const { return first_; } // inline definition const Thing& second() const { return second_; } // inline definition void set_first(const Thing ©me); void set_second(const Thing ©me); void Swap(); private: Thing first_, second_; }; template std::ostream& operator<<(std::ostream &out, const Pair &p); // The compiler must see the definition for any template that is // used. That means customers of Pair.h need to be // shown the definition of class Pair; one way to do this is to // include the .cc file associated with the .h file right in // the header, as follows. This is the "inclusion compilation // model" aka "option 2" #include "Pair.cc" #endif // PAIR_H_