197403Sobrien// std::rel_ops implementation -*- C++ -*- 297403Sobrien 3169691Skan// Copyright (C) 2001, 2002, 2004, 2005 Free Software Foundation, Inc. 497403Sobrien// 597403Sobrien// This file is part of the GNU ISO C++ Library. This library is free 697403Sobrien// software; you can redistribute it and/or modify it under the 797403Sobrien// terms of the GNU General Public License as published by the 897403Sobrien// Free Software Foundation; either version 2, or (at your option) 997403Sobrien// any later version. 1097403Sobrien 1197403Sobrien// This library is distributed in the hope that it will be useful, 1297403Sobrien// but WITHOUT ANY WARRANTY; without even the implied warranty of 1397403Sobrien// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 1497403Sobrien// GNU General Public License for more details. 1597403Sobrien 1697403Sobrien// You should have received a copy of the GNU General Public License along 1797403Sobrien// with this library; see the file COPYING. If not, write to the Free 18169691Skan// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 1997403Sobrien// USA. 2097403Sobrien 2197403Sobrien// As a special exception, you may use this file as part of a free software 2297403Sobrien// library without restriction. Specifically, if other files instantiate 2397403Sobrien// templates or use macros or inline functions from this file, or you compile 2497403Sobrien// this file and link it with other files to produce an executable, this 2597403Sobrien// file does not by itself cause the resulting executable to be covered by 2697403Sobrien// the GNU General Public License. This exception does not however 2797403Sobrien// invalidate any other reasons why the executable file might be covered by 2897403Sobrien// the GNU General Public License. 2997403Sobrien 3097403Sobrien/* 3197403Sobrien * 3297403Sobrien * Copyright (c) 1994 3397403Sobrien * Hewlett-Packard Company 3497403Sobrien * 3597403Sobrien * Permission to use, copy, modify, distribute and sell this software 3697403Sobrien * and its documentation for any purpose is hereby granted without fee, 3797403Sobrien * provided that the above copyright notice appear in all copies and 3897403Sobrien * that both that copyright notice and this permission notice appear 3997403Sobrien * in supporting documentation. Hewlett-Packard Company makes no 4097403Sobrien * representations about the suitability of this software for any 4197403Sobrien * purpose. It is provided "as is" without express or implied warranty. 4297403Sobrien * 4397403Sobrien * Copyright (c) 1996,1997 4497403Sobrien * Silicon Graphics 4597403Sobrien * 4697403Sobrien * Permission to use, copy, modify, distribute and sell this software 4797403Sobrien * and its documentation for any purpose is hereby granted without fee, 4897403Sobrien * provided that the above copyright notice appear in all copies and 4997403Sobrien * that both that copyright notice and this permission notice appear 5097403Sobrien * in supporting documentation. Silicon Graphics makes no 5197403Sobrien * representations about the suitability of this software for any 5297403Sobrien * purpose. It is provided "as is" without express or implied warranty. 5397403Sobrien * 5497403Sobrien */ 5597403Sobrien 5697403Sobrien/** @file stl_relops.h 5797403Sobrien * This is an internal header file, included by other library headers. 5897403Sobrien * You should not attempt to use it directly. 5997403Sobrien * 6097403Sobrien * @if maint 6197403Sobrien * Inclusion of this file has been removed from 6297403Sobrien * all of the other STL headers for safety reasons, except std_utility.h. 6397403Sobrien * For more information, see the thread of about twenty messages starting 6497403Sobrien * with http://gcc.gnu.org/ml/libstdc++/2001-01/msg00223.html , or the 6597403Sobrien * FAQ at http://gcc.gnu.org/onlinedocs/libstdc++/faq/index.html#4_4 . 6697403Sobrien * 6797403Sobrien * Short summary: the rel_ops operators should be avoided for the present. 6897403Sobrien * @endif 6997403Sobrien */ 7097403Sobrien 71132720Skan#ifndef _STL_RELOPS_H 72132720Skan#define _STL_RELOPS_H 1 7397403Sobrien 74169691Skan_GLIBCXX_BEGIN_NAMESPACE(std) 75169691Skan 7697403Sobrien namespace rel_ops 7797403Sobrien { 78132720Skan /** @namespace std::rel_ops 79132720Skan * @brief The generated relational operators are sequestered here. 80132720Skan */ 8197403Sobrien 82132720Skan /** 83132720Skan * @brief Defines @c != for arbitrary types, in terms of @c ==. 84132720Skan * @param x A thing. 85132720Skan * @param y Another thing. 86132720Skan * @return x != y 87132720Skan * 88132720Skan * This function uses @c == to determine its result. 89132720Skan */ 90132720Skan template <class _Tp> 91132720Skan inline bool 92132720Skan operator!=(const _Tp& __x, const _Tp& __y) 93132720Skan { return !(__x == __y); } 9497403Sobrien 95132720Skan /** 96132720Skan * @brief Defines @c > for arbitrary types, in terms of @c <. 97132720Skan * @param x A thing. 98132720Skan * @param y Another thing. 99132720Skan * @return x > y 100132720Skan * 101132720Skan * This function uses @c < to determine its result. 102132720Skan */ 103132720Skan template <class _Tp> 104132720Skan inline bool 105132720Skan operator>(const _Tp& __x, const _Tp& __y) 106132720Skan { return __y < __x; } 10797403Sobrien 108132720Skan /** 109132720Skan * @brief Defines @c <= for arbitrary types, in terms of @c <. 110132720Skan * @param x A thing. 111132720Skan * @param y Another thing. 112132720Skan * @return x <= y 113132720Skan * 114132720Skan * This function uses @c < to determine its result. 115132720Skan */ 116132720Skan template <class _Tp> 117132720Skan inline bool 118132720Skan operator<=(const _Tp& __x, const _Tp& __y) 119132720Skan { return !(__y < __x); } 12097403Sobrien 121132720Skan /** 122132720Skan * @brief Defines @c >= for arbitrary types, in terms of @c <. 123132720Skan * @param x A thing. 124132720Skan * @param y Another thing. 125132720Skan * @return x >= y 126132720Skan * 127132720Skan * This function uses @c < to determine its result. 128132720Skan */ 129132720Skan template <class _Tp> 130132720Skan inline bool 131132720Skan operator>=(const _Tp& __x, const _Tp& __y) 132132720Skan { return !(__x < __y); } 13397403Sobrien 13497403Sobrien } // namespace rel_ops 13597403Sobrien 136169691Skan_GLIBCXX_END_NAMESPACE 137169691Skan 138132720Skan#endif /* _STL_RELOPS_H */ 139