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
|
#pragma once
template<typename T, typename D>
class Pair
{
T first;
D second;
public:
Pair() = default;
Pair(const T& first, const D& second);
const T& getFirst() const;
const D& getSecond() const;
void setFirst(const T& newValue);
void setSecond(const D& newValue);
};
template<typename T, typename D>
Pair<T,D>::Pair(const T& first, const D& second) : first(first), second(second)
{}
template<typename T, typename D>
const T& Pair<T, D>::getFirst() const
{
return first;
}
template<typename T, typename D>
const D& Pair<T, D>::getSecond() const
{
return second;
}
template<typename T, typename D>
void Pair<T, D>::setFirst(const T& newValue)
{
first = newValue;
}
template<typename T, typename D>
void Pair<T, D>::setSecond(const D& newValue)
{
second = newValue;
}
|