#ifndef TRACERWITHHISTORY_H_ #define TRACERWITHHISTORY_H_ #include #include #include // This is a version of Tracer which tracks the entire history of // its values, not just the most recent one. Its interface is // designed to be a a drop-in replacement of Tracer, and its // classname is deliberately terse to facilitate live coding. class TracerH { public: // Constructors. TracerH(); ~TracerH(); TracerH(const TracerH &rhs); // Assignment operator. TracerH &operator=(const TracerH &rhs); // Less-than comparison operator. bool operator<(const TracerH &rhs) const; // << operator friend std::ostream &operator<<(std::ostream &out, const TracerH &rhs); private: // Return "id_ [history_]" as a string std::string Print(void) const; // This static (class member) tracks the next id_ to hand out. static int nextid_; const int id_; // fixed id of this Tracer std::vector history_; // the history of ids that lead to this Tracer }; #endif // TRACERWITHHISTORY_H_