diff options
1 files changed, 43 insertions, 0 deletions
| -rw-r--r-- | Week11/Exercise05/Pair.hpp | 43 |
diff --git a/Week11/Exercise05/Pair.hpp b/Week11/Exercise05/Pair.hpp new file mode 100644 index 0000000..4fd47fd --- /dev/null +++ b/Week11/Exercise05/Pair.hpp @@ -0,0 +1,43 @@ +#ifndef _PAIR +#define _PAIR + +template<class T, class U> +class Pair { + T left; + U right; + +public: + Pair(const T& left, const U& right); + + T& Left(); + const T& Left() const; + + U& Right(); + const U& Right() const; +}; + +template<class T, class U> +Pair<T, U>::Pair(const T& left, const U& right) : left(left), right(right) +{ } + +template<class T, class U> +T& Pair<T, U>::Left() { + return left; +} + +template<class T, class U> +const T& Pair<T, U>::Left() const { + return left; +} + +template<class T, class U> +U& Pair<T, U>::Right() { + return right; +} + +template<class T, class U> +const U& Pair<T, U>::Right() const { + return right; +} + +#endif /* _PAIR */ |
