Website Summary Files Commits Branches @commit @diff @stats
path: root / Week11 / Exercise01 / Pair.hpp
blob: 4fd47fd772a80c30271d40e4fd41935c0e3c38ce (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
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 */