Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using std::cout;
- using std::endl;
- template <class T>
- class Pair
- {
- public:
- Pair(T left, T right): left(left), right(right) {}
- const T& getLeft() const { return left; }
- const T& getRight() const { return right; }
- private:
- T left;
- T right;
- };
- template <template <class ST> class T>
- class Node
- {
- public:
- Node(T<ST> value):
- value(value)
- {
- }
- const auto& getValue() const { return value; }
- auto getLeft() { return value.getLeft(); } // ST getLeft()
- auto getRight() { return value.getRight(); } // ST getRight()
- private:
- T<ST> value;
- };
- int main()
- {
- Node<Pair<int>> node({5, 6});
- // cout << "Created a node with a pair with left "
- // << node.getLeft()
- // << " and right "
- // << node.getRight()
- // << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement