# stl_relops.h

Go to the documentation of this file.

    00001 // std::rel_ops implementation -*- C++ -*-
    00002
    00003 // Copyright (C) 2001, 2002, 2004, 2005, 2008 Free Software Foundation, Inc.
    00004 //
    00005 // This file is part of the GNU ISO C++ Library.  This library is free
    00006 // software; you can redistribute it and/or modify it under the
    00007 // terms of the GNU General Public License as published by the
    00008 // Free Software Foundation; either version 3, or (at your option)
    00009 // any later version.
    00010
    00011 // This library is distributed in the hope that it will be useful,
    00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of
    00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    00014 // GNU General Public License for more details.
    00015
    00016 // Under Section 7 of GPL version 3, you are granted additional
    00017 // permissions described in the GCC Runtime Library Exception, version
    00018 // 3.1, as published by the, 2009 Free Software Foundation.
    00019
    00020 // You should have received a copy of the GNU General Public License and
    00021 // a copy of the GCC Runtime Library Exception along with this program;
    00022 // see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
    00023 // <http://www.gnu.org/licenses/>.
    00024
    00025 /*
    00026  *
    00027  * Copyright (c) 1994
    00028  * Hewlett-Packard Company
    00029  *
    00030  * Permission to use, copy, modify, distribute and sell this software
    00031  * and its documentation for any purpose is hereby granted without fee,
    00032  * provided that the above copyright notice appear in all copies and
    00033  * that both that copyright notice and this permission notice appear
    00034  * in supporting documentation.  Hewlett-Packard Company makes no
    00035  * representations about the suitability of this software for any
    00036  * purpose.  It is provided "as is" without express or implied warranty.
    00037  *
    00038  * Copyright (c) 1996,1997
    00039  * Silicon Graphics
    00040  *
    00041  * Permission to use, copy, modify, distribute and sell this software
    00042  * and its documentation for any purpose is hereby granted without fee,
    00043  * provided that the above copyright notice appear in all copies and
    00044  * that both that copyright notice and this permission notice appear
    00045  * in supporting documentation.  Silicon Graphics makes no
    00046  * representations about the suitability of this software for any
    00047  * purpose.  It is provided "as is" without express or implied warranty.
    00048  *
    00049  */
    00050
    00051 /** @file stl_relops.h
    00052  *  This is an internal header file, included by other library headers.
    00053  *  You should not attempt to use it directly.
    00054  *
    00055  *  Inclusion of this file has been removed from
    00056  *  all of the other STL headers for safety reasons, except std_utility.h.
    00057  *  For more information, see the thread of about twenty messages starting
    00058  *  with http://gcc.gnu.org/ml/libstdc++/2001-01/msg00223.html, or
    00059  *  http://gcc.gnu.org/onlinedocs/libstdc++/faq.html#faq.ambiguous_overloads
    00060  *
    00061  *  Short summary:  the rel_ops operators should be avoided for the present.
    00062  */
    00063
    00064 #ifndef _STL_RELOPS_H
    00065 #define _STL_RELOPS_H 1
    00066
    00067 _GLIBCXX_BEGIN_NAMESPACE(std)
    00068
    00069   namespace rel_ops
    00070   {
    00071     /** @namespace std::rel_ops
    00072      *  @brief  The generated relational operators are sequestered here.
    00073      */
    00074
    00075     /**
    00076      *  @brief Defines @c != for arbitrary types, in terms of @c ==.
    00077      *  @param  x  A thing.
    00078      *  @param  y  Another thing.
    00079      *  @return   x != y
    00080      *
    00081      *  This function uses @c == to determine its result.
    00082      */
    00083     template <class _Tp>
    00084       inline bool
    00085       operator!=(const _Tp& __x, const _Tp& __y)
    00086       { return !(__x == __y); }
    00087
    00088     /**
    00089      *  @brief Defines @c > for arbitrary types, in terms of @c <.
    00090      *  @param  x  A thing.
    00091      *  @param  y  Another thing.
    00092      *  @return   x > y
    00093      *
    00094      *  This function uses @c < to determine its result.
    00095      */
    00096     template <class _Tp>
    00097       inline bool
    00098       operator>(const _Tp& __x, const _Tp& __y)
    00099       { return __y < __x; }
    00100
    00101     /**
    00102      *  @brief Defines @c <= for arbitrary types, in terms of @c <.
    00103      *  @param  x  A thing.
    00104      *  @param  y  Another thing.
    00105      *  @return   x <= y
    00106      *
    00107      *  This function uses @c < to determine its result.
    00108      */
    00109     template <class _Tp>
    00110       inline bool
    00111       operator<=(const _Tp& __x, const _Tp& __y)
    00112       { return !(__y < __x); }
    00113
    00114     /**
    00115      *  @brief Defines @c >= for arbitrary types, in terms of @c <.
    00116      *  @param  x  A thing.
    00117      *  @param  y  Another thing.
    00118      *  @return   x >= y
    00119      *
    00120      *  This function uses @c < to determine its result.
    00121      */
    00122     template <class _Tp>
    00123       inline bool
    00124       operator>=(const _Tp& __x, const _Tp& __y)
    00125       { return !(__x < __y); }
    00126
    00127   } // namespace rel_ops
    00128
    00129 _GLIBCXX_END_NAMESPACE
    00130
    00131 #endif /* _STL_RELOPS_H */