Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Blame | Last modification | View Log | RSS feed

  1. /*      Copyright (C) 2004 Garrett A. Kajmowicz
  2.         This file is part of the uClibc++ Library.
  3.  
  4.         This library is free software; you can redistribute it and/or
  5.         modify it under the terms of the GNU Lesser General Public
  6.         License as published by the Free Software Foundation; either
  7.         version 2.1 of the License, or (at your option) any later version.
  8.  
  9.         This library is distributed in the hope that it will be useful,
  10.         but WITHOUT ANY WARRANTY; without even the implied warranty of
  11.         MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  12.         Lesser General Public License for more details.
  13.  
  14.         You should have received a copy of the GNU Lesser General Public
  15.         License along with this library; if not, write to the Free Software
  16.         Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  17.  
  18. */
  19.  
  20.  
  21. #include <basic_definitions>
  22.  
  23.  
  24. #ifndef __STD_HEADER_UTILITY
  25. #define __STD_HEADER_UTILITY 1
  26.  
  27. #pragma GCC visibility push(default)
  28.  
  29. namespace std{
  30.  
  31.         namespace rel_ops {
  32.                 template<class T> inline bool operator!=(const T& x, const T& y){
  33.                         return !(x == y);
  34.                 }
  35.  
  36.                 template<class T> inline bool operator> (const T& x, const T& y){
  37.                         return ( y < x);
  38.                 }
  39.  
  40.                 template<class T> inline bool operator<=(const T& x, const T& y){
  41.                         return !( y < x );
  42.                 }
  43.  
  44.                 template<class T> inline bool operator>=(const T& x, const T& y){
  45.                         return !(x < y);
  46.                 }
  47.         }
  48.  
  49.         template <class T1, class T2> struct _UCXXEXPORT pair {
  50.                 typedef T1 first_type;
  51.                 typedef T2 second_type;
  52.  
  53.                 T1 first;
  54.                 T2 second;
  55.                 pair() : first(), second() {  }
  56.                 pair(const T1& x, const T2& y) : first(x), second(y) {  }
  57.                 template<class U, class V> pair(const pair<U, V> &p) : first(p.first), second(p.second) { }
  58.         };
  59.        
  60.         template <class T1, class T2> bool operator==(const pair<T1,T2>& x, const pair<T1,T2>& y){
  61.                 using namespace rel_ops;
  62.                 return (x.first == y.first && x.second==y.second);
  63.         }
  64.         template <class T1, class T2> bool operator< (const pair<T1,T2>& x, const pair<T1,T2>& y){
  65.                 return x.first < y.first || (!(y.first < x.first) && x.second < y.second);
  66.         }
  67.         template <class T1, class T2> bool operator!=(const pair<T1,T2>& x, const pair<T1,T2>& y){
  68.                 return !(x == y);
  69.         }
  70.         template <class T1, class T2> bool operator> (const pair<T1,T2>& x, const pair<T1,T2>& y){
  71.                 return y < x;
  72.         }
  73.         template <class T1, class T2> bool operator>=(const pair<T1,T2>& x, const pair<T1,T2>& y){
  74.                 return !(x < y);
  75.         }
  76.         template <class T1, class T2> bool operator<=(const pair<T1,T2>& x, const pair<T1,T2>& y){
  77.                 return !(y < x);
  78.         }
  79.         template <class T1, class T2> pair<T1,T2> make_pair(const T1& x, const T2& y){
  80.                 return pair<T1,T2>(x, y);
  81.         }
  82.  
  83.  
  84. }
  85.  
  86. #pragma GCC visibility pop
  87.  
  88. #endif  //__STD_HEADER_UTILITY
  89.