Page 1 of 1

Draw a sketch of a Pair containing the elements "CPSC" and 131. Replace this with your sketch. Opera

Posted: Tue Sep 07, 2021 7:49 am
by answerhappygod
Draw A Sketch Of A Pair Std String Int Containing The Elements Cpsc And 131 Replace This With Your Sketch Opera 1
Draw A Sketch Of A Pair Std String Int Containing The Elements Cpsc And 131 Replace This With Your Sketch Opera 1 (4.27 KiB) Viewed 64 times
Draw a sketch of a Pair<std::string, int> containing the elements "CPSC" and 131. Replace this with your sketch.
Operations Your Pair class will need to implement the following public API. Class Template template <class Ti, class T2> class Pair; Construction and Destruction Pair(const T1& first, const T2& second): Constructor. Pair(const Pair<T1, T2>& other): Copy constructor. Pair& operator=(const Pair<T1, T2>& other): Copy assignment constructor Pair(): Destructor Observers T1 first() const: Return a copy of the first of the objects. T2 second() const: Return a copy of the second of the objects. Modifiers void set_first(const T1& first): Set the first object of the class. Like all of the data structures in this course, in practice we should not be designing and implementing, we should be reusing (here, std::pair). In practice, for each of these use cases, it might be better to create a specialized class rather than using a generic Pair class. void set_second(const T2& second): Set the second object of the class. void swap(Pair<T1, T2>& other): (optional to implement) Swap this pair with other.