Merge from mainline (168000:168310).
[official-gcc/graphite-test-results.git] / libstdc++-v3 / include / bits / stl_relops.h
blob10e41703faea51b75f7d78c71d8cb35e82175b1a
1 // std::rel_ops implementation -*- C++ -*-
3 // Copyright (C) 2001, 2002, 2004, 2005, 2008 Free Software Foundation, Inc.
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
8 // Free Software Foundation; either version 3, or (at your option)
9 // any later version.
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.
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.
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/>.
27 * Copyright (c) 1994
28 * Hewlett-Packard Company
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.
38 * Copyright (c) 1996,1997
39 * Silicon Graphics
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.
51 /** @file bits/stl_relops.h
52 * This is an internal header file, included by other library headers.
53 * Do not attempt to use it directly. @headername{utility}
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
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
61 * Short summary: the rel_ops operators should be avoided for the present.
64 #ifndef _STL_RELOPS_H
65 #define _STL_RELOPS_H 1
67 _GLIBCXX_BEGIN_NAMESPACE(std)
69 namespace rel_ops
71 /** @namespace std::rel_ops
72 * @brief The generated relational operators are sequestered here.
75 /**
76 * @brief Defines @c != for arbitrary types, in terms of @c ==.
77 * @param x A thing.
78 * @param y Another thing.
79 * @return x != y
81 * This function uses @c == to determine its result.
83 template <class _Tp>
84 inline bool
85 operator!=(const _Tp& __x, const _Tp& __y)
86 { return !(__x == __y); }
88 /**
89 * @brief Defines @c > for arbitrary types, in terms of @c <.
90 * @param x A thing.
91 * @param y Another thing.
92 * @return x > y
94 * This function uses @c < to determine its result.
96 template <class _Tp>
97 inline bool
98 operator>(const _Tp& __x, const _Tp& __y)
99 { return __y < __x; }
102 * @brief Defines @c <= for arbitrary types, in terms of @c <.
103 * @param x A thing.
104 * @param y Another thing.
105 * @return x <= y
107 * This function uses @c < to determine its result.
109 template <class _Tp>
110 inline bool
111 operator<=(const _Tp& __x, const _Tp& __y)
112 { return !(__y < __x); }
115 * @brief Defines @c >= for arbitrary types, in terms of @c <.
116 * @param x A thing.
117 * @param y Another thing.
118 * @return x >= y
120 * This function uses @c < to determine its result.
122 template <class _Tp>
123 inline bool
124 operator>=(const _Tp& __x, const _Tp& __y)
125 { return !(__x < __y); }
127 } // namespace rel_ops
129 _GLIBCXX_END_NAMESPACE
131 #endif /* _STL_RELOPS_H */