]>
Commit | Line | Data |
---|---|---|
1d61409b | 1 | // std::rel_ops implementation -*- C++ -*- |
2 | ||
fbd26352 | 3 | // Copyright (C) 2001-2019 Free Software Foundation, Inc. |
1d61409b | 4 | // |
5 | // This file is part of the GNU ISO C++ Library. This library is free | |
6 | // software; you can redistribute it and/or modify it under the | |
7 | // terms of the GNU General Public License as published by the | |
6bc9506f | 8 | // Free Software Foundation; either version 3, or (at your option) |
1d61409b | 9 | // any later version. |
10 | ||
11 | // This library is distributed in the hope that it will be useful, | |
12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 | // GNU General Public License for more details. | |
15 | ||
6bc9506f | 16 | // Under Section 7 of GPL version 3, you are granted additional |
17 | // permissions described in the GCC Runtime Library Exception, version | |
18 | // 3.1, as published by the, 2009 Free Software Foundation. | |
1d61409b | 19 | |
6bc9506f | 20 | // You should have received a copy of the GNU General Public License and |
21 | // a copy of the GCC Runtime Library Exception along with this program; | |
22 | // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see | |
23 | // <http://www.gnu.org/licenses/>. | |
1d61409b | 24 | |
1d487aca | 25 | /* |
26 | * | |
27 | * Copyright (c) 1994 | |
28 | * Hewlett-Packard Company | |
29 | * | |
30 | * Permission to use, copy, modify, distribute and sell this software | |
31 | * and its documentation for any purpose is hereby granted without fee, | |
32 | * provided that the above copyright notice appear in all copies and | |
33 | * that both that copyright notice and this permission notice appear | |
34 | * in supporting documentation. Hewlett-Packard Company makes no | |
35 | * representations about the suitability of this software for any | |
36 | * purpose. It is provided "as is" without express or implied warranty. | |
37 | * | |
38 | * Copyright (c) 1996,1997 | |
39 | * Silicon Graphics | |
40 | * | |
41 | * Permission to use, copy, modify, distribute and sell this software | |
42 | * and its documentation for any purpose is hereby granted without fee, | |
43 | * provided that the above copyright notice appear in all copies and | |
44 | * that both that copyright notice and this permission notice appear | |
45 | * in supporting documentation. Silicon Graphics makes no | |
46 | * representations about the suitability of this software for any | |
47 | * purpose. It is provided "as is" without express or implied warranty. | |
48 | * | |
49 | */ | |
50 | ||
5846aeac | 51 | /** @file bits/stl_relops.h |
7a472ef1 | 52 | * This is an internal header file, included by other library headers. |
5846aeac | 53 | * Do not attempt to use it directly. @headername{utility} |
f51d6a00 | 54 | * |
f51d6a00 | 55 | * Inclusion of this file has been removed from |
56 | * all of the other STL headers for safety reasons, except std_utility.h. | |
57 | * For more information, see the thread of about twenty messages starting | |
c53be2be | 58 | * with http://gcc.gnu.org/ml/libstdc++/2001-01/msg00223.html, or |
59 | * http://gcc.gnu.org/onlinedocs/libstdc++/faq.html#faq.ambiguous_overloads | |
f51d6a00 | 60 | * |
5846aeac | 61 | * Short summary: the rel_ops operators should be avoided for the present. |
7a472ef1 | 62 | */ |
63 | ||
5a64d8cf | 64 | #ifndef _STL_RELOPS_H |
65 | #define _STL_RELOPS_H 1 | |
1d487aca | 66 | |
2948dd21 | 67 | namespace std _GLIBCXX_VISIBILITY(default) |
68 | { | |
ae6a4ce9 | 69 | _GLIBCXX_BEGIN_NAMESPACE_VERSION |
70 | ||
0d994a35 | 71 | namespace rel_ops |
72 | { | |
b9156b5c | 73 | /** @namespace std::rel_ops |
74 | * @brief The generated relational operators are sequestered here. | |
75 | */ | |
bae9b8af | 76 | |
b9156b5c | 77 | /** |
78 | * @brief Defines @c != for arbitrary types, in terms of @c ==. | |
e12e4f3b | 79 | * @param __x A thing. |
80 | * @param __y Another thing. | |
81 | * @return __x != __y | |
b9156b5c | 82 | * |
83 | * This function uses @c == to determine its result. | |
84 | */ | |
85 | template <class _Tp> | |
86 | inline bool | |
87 | operator!=(const _Tp& __x, const _Tp& __y) | |
88 | { return !(__x == __y); } | |
f51d6a00 | 89 | |
b9156b5c | 90 | /** |
91 | * @brief Defines @c > for arbitrary types, in terms of @c <. | |
e12e4f3b | 92 | * @param __x A thing. |
93 | * @param __y Another thing. | |
94 | * @return __x > __y | |
b9156b5c | 95 | * |
96 | * This function uses @c < to determine its result. | |
97 | */ | |
98 | template <class _Tp> | |
99 | inline bool | |
100 | operator>(const _Tp& __x, const _Tp& __y) | |
101 | { return __y < __x; } | |
1d487aca | 102 | |
b9156b5c | 103 | /** |
104 | * @brief Defines @c <= for arbitrary types, in terms of @c <. | |
e12e4f3b | 105 | * @param __x A thing. |
106 | * @param __y Another thing. | |
107 | * @return __x <= __y | |
b9156b5c | 108 | * |
109 | * This function uses @c < to determine its result. | |
110 | */ | |
111 | template <class _Tp> | |
112 | inline bool | |
113 | operator<=(const _Tp& __x, const _Tp& __y) | |
114 | { return !(__y < __x); } | |
1d487aca | 115 | |
b9156b5c | 116 | /** |
117 | * @brief Defines @c >= for arbitrary types, in terms of @c <. | |
e12e4f3b | 118 | * @param __x A thing. |
119 | * @param __y Another thing. | |
120 | * @return __x >= __y | |
b9156b5c | 121 | * |
122 | * This function uses @c < to determine its result. | |
123 | */ | |
124 | template <class _Tp> | |
125 | inline bool | |
126 | operator>=(const _Tp& __x, const _Tp& __y) | |
127 | { return !(__x < __y); } | |
0d994a35 | 128 | } // namespace rel_ops |
1069247d | 129 | |
ae6a4ce9 | 130 | _GLIBCXX_END_NAMESPACE_VERSION |
2948dd21 | 131 | } // namespace std |
1d487aca | 132 | |
5a64d8cf | 133 | #endif /* _STL_RELOPS_H */ |