-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcomp.hpp
More file actions
51 lines (42 loc) · 1.46 KB
/
comp.hpp
File metadata and controls
51 lines (42 loc) · 1.46 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
#ifndef COMP_HPP
#define COMP_HPP
namespace ft
{
// __equal_to
template <class T1, class T2 = T1>
struct __equal_to
{
bool operator()(const T1& x, const T1& y) const { return x == y; }
bool operator()(const T1& x, const T2& y) const { return x == y; }
bool operator()(const T2& x, const T1& y) const { return x == y; }
bool operator()(const T2& x, const T2& y) const { return x == y; }
};
template <class T1>
struct __equal_to<T1, T1>
{ bool operator()(const T1& x, const T1& y) const { return x == y; } };
template <class T1>
struct __equal_to<const T1, T1>
{ bool operator()(const T1& x, const T1& y) const { return x == y; } };
template <class T1>
struct __equal_to<T1, const T1>
{ bool operator()(const T1& x, const T1& y) const { return x == y; } };
// __less
template <class T1, class T2 = T1>
struct __less
{
bool operator()(const T1& x, const T1& y) const { return x < y; }
bool operator()(const T1& x, const T2& y) const { return x < y; }
bool operator()(const T2& x, const T1& y) const { return x < y; }
bool operator()(const T2& x, const T2& y) const { return x < y; }
};
template <class T1>
struct __less<T1, T1>
{ bool operator()(const T1& x, const T1& y) const { return x < y; } };
template <class T1>
struct __less<const T1, T1>
{ bool operator()(const T1& x, const T1& y) const { return x < y; } };
template <class T1>
struct __less<T1, const T1>
{ bool operator()(const T1& x, const T1& y) const { return x < y; } };
}
#endif