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