diff options
| Commit | 5e9cb4ddc811465731596d8ee684f3d8cd5a6aea (patch) | |
|---|---|---|
| Author | 2026-05-02 16:05:06 +0300 | |
| Committer | 2026-05-02 16:05:06 +0300 | |
| Files | 33a9268d1136974d2ef138364dde508ba43b4a52 /Week11/Exercise01/Pair.hpp | |
| oop-2025-solutions-main.tar oop-2025-solutions-main.tar.gz oop-2025-solutions-main.zip | ||
| Parent | 7546f0d0da487e16f0a8671c09a46e1cee2bc03a (diff) | |
1 files changed, 43 insertions, 0 deletions
| -rw-r--r-- | Week11/Exercise01/Pair.hpp | 43 |
diff --git a/Week11/Exercise01/Pair.hpp b/Week11/Exercise01/Pair.hpp new file mode 100644 index 0000000..4fd47fd --- /dev/null +++ b/Week11/Exercise01/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 */ |
