-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstl_pair.h
More file actions
62 lines (49 loc) · 1.76 KB
/
Copy pathstl_pair.h
File metadata and controls
62 lines (49 loc) · 1.76 KB
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
//
// Created by sakura on 2020/5/20.
//
#ifndef SAKURA_STL_STL_PAIR_H
#define SAKURA_STL_STL_PAIR_H
#include "stl_config.h"
__STL_BEGIN_NAMESPACE
template<class _T1, class _T2>
struct pair {
typedef _T1 first_type;
typedef _T2 second_type;
_T1 first;
_T2 second;
pair() : first(_T1()), second(_T2()) {}
pair(const _T1 &__a, const _T2 &__b) : first(__a), second(__b) {}
template<class _U1, class _U2>
pair(const pair<_U1, _U2> &__p) : first(__p.first), second(__p.second) {}
};
template<class _T1, class _T2>
inline bool operator==(const pair<_T1, _T2> &__x, const pair<_T1, _T2> &__y) {
return __x.first == __y.first && __x.second == __y.second;
}
template<class _T1, class _T2>
inline bool operator<(const pair<_T1, _T2> &__x, const pair<_T1, _T2> &__y) {
return __x.first < __y.first ||
(!(__y.first < __x.first) && __x.second < __y.second);
}
template<class _T1, class _T2>
inline bool operator!=(const pair<_T1, _T2> &__x, const pair<_T1, _T2> &__y) {
return !(__x == __y);
}
template<class _T1, class _T2>
inline bool operator>(const pair<_T1, _T2> &__x, const pair<_T1, _T2> &__y) {
return __y < __x;
}
template<class _T1, class _T2>
inline bool operator<=(const pair<_T1, _T2> &__x, const pair<_T1, _T2> &__y) {
return !(__y < __x);
}
template<class _T1, class _T2>
inline bool operator>=(const pair<_T1, _T2> &__x, const pair<_T1, _T2> &__y) {
return !(__x < __y);
}
template<class _T1, class _T2>
inline pair<_T1, _T2> make_pair(const _T1 &__x, const _T2 &__y) {
return pair<_T1, _T2>(__x, __y);
}
__STL_END_NAMESPACE
#endif //SAKURA_STL_STL_PAIR_H