Adobe Source Libraries 1.49.0
A collection of C++ libraries.
Loading...
Searching...
No Matches
pair.hpp
Go to the documentation of this file.
1/*
2 Copyright 2013 Adobe
3 Distributed under the Boost Software License, Version 1.0.
4 (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
5*/
6/**************************************************************************************************/
7
8#ifndef ADOBE_UTILITY_PAIR_HPP
9#define ADOBE_UTILITY_PAIR_HPP
10
11/**************************************************************************************************/
12
13#include <adobe/config.hpp>
14
15#include <utility>
16
17#include <boost/operators.hpp>
18
19#include <adobe/empty.hpp>
20
21#include <adobe/implementation/swap.hpp>
22
23/**************************************************************************************************/
24
25namespace adobe {
26
27/**************************************************************************************************/
28
33
35template <typename T1, typename T2 = T1>
37 typedef T1 first_type;
38 typedef T2 second_type;
39
42
43 friend inline bool operator==(const aggregate_pair& x, const aggregate_pair& y) {
44 return x.first == y.first && x.second == y.second;
45 }
46
47 friend inline bool operator<(const aggregate_pair& x, const aggregate_pair& y) {
48 return x.first < y.first || (!(y.first < x.first) && x.second < y.second);
49 }
50
51 friend inline bool operator!=(const aggregate_pair& x, const aggregate_pair& y) {
52 return !(x == y);
53 }
54
55 friend inline bool operator>(const aggregate_pair& x, const aggregate_pair& y) { return y < x; }
56
57 friend inline bool operator<=(const aggregate_pair& x, const aggregate_pair& y) {
58 return !(y < x);
59 }
60
61 friend inline bool operator>=(const aggregate_pair& x, const aggregate_pair& y) {
62 return !(x < y);
63 }
64
65 friend inline void swap(aggregate_pair& x, aggregate_pair& y) {
66 swap(x.first, y.first);
67 swap(x.second, y.second);
68 }
69};
70
71/**************************************************************************************************/
72
73} // namespace adobe
74
75/**************************************************************************************************/
76
77// ADOBE_UTILITY_PAIR_HPP
78#endif
79
80/**************************************************************************************************/
friend bool operator==(const aggregate_pair &x, const aggregate_pair &y)
Definition pair.hpp:43
friend bool operator<(const aggregate_pair &x, const aggregate_pair &y)
Definition pair.hpp:47
friend bool operator>(const aggregate_pair &x, const aggregate_pair &y)
Definition pair.hpp:55
friend bool operator>=(const aggregate_pair &x, const aggregate_pair &y)
Definition pair.hpp:61
friend void swap(aggregate_pair &x, aggregate_pair &y)
Definition pair.hpp:65
friend bool operator<=(const aggregate_pair &x, const aggregate_pair &y)
Definition pair.hpp:57
friend bool operator!=(const aggregate_pair &x, const aggregate_pair &y)
Definition pair.hpp:51