#ifndef Y_PAIR_H #define Y_PAIR_H class Y_Pair { public: Y_Pair(Data* f, Data* s) : first{f}, second{s} {} ~Y_Pair() { delete first; delete second; } Y_Pair(Y_Pair const& rhs) = delete; Y_Pair(Y_Pair && rhs) : first{}, second{} { std::swap(first, rhs.first); std::swap(second, rhs.second); } Y_Pair& operator=(Y_Pair const& rhs) = delete; Y_Pair& operator=(Y_Pair && rhs) { std::swap(first, rhs.first); std::swap(second, rhs.second); return *this; } void swap() { std::swap(first, second); } Data const& get_first() { return *first; } Data const& get_second() { return *second; } private: Data* first; Data* second; }; #endif