epoc32/include/stdapis/stlport/stl/_pair.h
branchSymbian2
changeset 2 2fe1408b6811
parent 0 061f57f2323e
     1.1 --- a/epoc32/include/stdapis/stlport/stl/_pair.h	Tue Nov 24 13:55:44 2009 +0000
     1.2 +++ b/epoc32/include/stdapis/stlport/stl/_pair.h	Tue Mar 16 16:12:26 2010 +0000
     1.3 @@ -1,1 +1,210 @@
     1.4 -_pair.h
     1.5 +/*
     1.6 + *
     1.7 + * Copyright (c) 1994
     1.8 + * Hewlett-Packard Company
     1.9 + *
    1.10 + * Copyright (c) 1996,1997
    1.11 + * Silicon Graphics Computer Systems, Inc.
    1.12 + *
    1.13 + * Copyright (c) 1997
    1.14 + * Moscow Center for SPARC Technology
    1.15 + *
    1.16 + * Copyright (c) 1999 
    1.17 + * Boris Fomitchev
    1.18 + *
    1.19 + * This material is provided "as is", with absolutely no warranty expressed
    1.20 + * or implied. Any use is at your own risk.
    1.21 + *
    1.22 + * Permission to use or copy this software for any purpose is hereby granted 
    1.23 + * without fee, provided the above notices are retained on all copies.
    1.24 + * Permission to modify the code and to distribute modified code is granted,
    1.25 + * provided the above notices are retained, and a notice that the code was
    1.26 + * modified is included with the above copyright notice.
    1.27 + *
    1.28 + */
    1.29 +
    1.30 +
    1.31 +/* NOTE: This is an internal header file, included by other STL headers.
    1.32 + *   You should not attempt to use it directly.
    1.33 + */
    1.34 +
    1.35 +#ifndef _STLP_INTERNAL_PAIR_H
    1.36 +#define _STLP_INTERNAL_PAIR_H
    1.37 +
    1.38 +#include <stl/_construct.h>
    1.39 +
    1.40 +_STLP_BEGIN_NAMESPACE
    1.41 +
    1.42 +#ifdef _STLP_USE_TRAP_LEAVE
    1.43 +template <class _T1, class _T2>
    1.44 +struct pair {
    1.45 +  typedef _T1 first_type;
    1.46 +  typedef _T2 second_type;
    1.47 +
    1.48 +  _T1 first;
    1.49 +  _STLP_StackPusher<_T1> __pusher;
    1.50 +  _T2 second;
    1.51 +
    1.52 +  // first and second should construct themselves with their default constructors in ANSI order
    1.53 +  pair() : __pusher(&first) {
    1.54 +    CleanupStack::Pop();
    1.55 +  }
    1.56 +
    1.57 +  pair(const _T1& __a, const _T2& __b) : first(__a), __pusher(&first), second(__b) {
    1.58 +    CleanupStack::Pop();
    1.59 +  }
    1.60 +
    1.61 +  // undergroud extensions
    1.62 +  pair(const _T1& __a, __false_type) : first(__a), __pusher(&first), second() {
    1.63 +    CleanupStack::Pop();
    1.64 +  }
    1.65 +  pair(__true_type, const _T2& __a) : first(), __pusher(&first), second(__a) {
    1.66 +    CleanupStack::Pop();
    1.67 +  }
    1.68 +
    1.69 +#if defined (_STLP_MEMBER_TEMPLATES) && !(defined (_STLP_MSVC) && (_STLP_MSVC < 1200))
    1.70 +  template <class _U1, class _U2>
    1.71 +  pair(const pair<_U1, _U2>& __p) : first(__p.first), __pusher(&first), second(__p.second) {
    1.72 +    CleanupStack::Pop();
    1.73 +  }
    1.74 +
    1.75 +  pair(const pair<_T1,_T2>& __o) : first(__o.first), __pusher(&first), second(__o.second) {
    1.76 +    CleanupStack::Pop();
    1.77 +  }
    1.78 +#endif
    1.79 +  __TRIVIAL_DESTRUCTOR(pair)
    1.80 +};
    1.81 +
    1.82 +#else
    1.83 +
    1.84 +template <class _T1, class _T2>
    1.85 +struct pair {
    1.86 +  typedef _T1 first_type;
    1.87 +  typedef _T2 second_type;
    1.88 +
    1.89 +  _T1 first;
    1.90 +  _T2 second;
    1.91 +# if defined (_STLP_CONST_CONSTRUCTOR_BUG)
    1.92 +  pair() {}
    1.93 +# else
    1.94 +  pair() : first(_T1()), second(_T2()) {}
    1.95 +# endif
    1.96 +  pair(const _T1& __a, const _T2& __b) : first(__a), second(__b) {}
    1.97 +
    1.98 +  // undergroud extensions
    1.99 +  pair(const _T1& __a, __false_type) : first(__a), second() {}
   1.100 +  pair(const _T2& __a, __true_type) : first(), second(__a) {}
   1.101 +
   1.102 +#if defined (_STLP_MEMBER_TEMPLATES) && !(defined (_STLP_MSVC) && (_STLP_MSVC < 1200))
   1.103 +  template <class _U1, class _U2>
   1.104 +  pair(const pair<_U1, _U2>& __p) : first(__p.first), second(__p.second) {}
   1.105 +
   1.106 +  pair(const pair<_T1,_T2>& __o) : first(__o.first), second(__o.second) {}
   1.107 +#endif
   1.108 +  __TRIVIAL_DESTRUCTOR(pair)
   1.109 +};
   1.110 +#endif
   1.111 +
   1.112 +template <class _T1, class _T2>
   1.113 +inline bool _STLP_CALL operator==(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
   1.114 +{ 
   1.115 +  return __x.first == __y.first && __x.second == __y.second; 
   1.116 +}
   1.117 +
   1.118 +template <class _T1, class _T2>
   1.119 +inline bool _STLP_CALL operator<(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
   1.120 +{ 
   1.121 +  return __x.first < __y.first || 
   1.122 +         (!(__y.first < __x.first) && __x.second < __y.second); 
   1.123 +}
   1.124 +
   1.125 +#ifdef _STLP_USE_SEPARATE_RELOPS_NAMESPACE
   1.126 +
   1.127 +template <class _T1, class _T2>
   1.128 +inline bool _STLP_CALL operator!=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) {
   1.129 +  return !(__x == __y);
   1.130 +}
   1.131 +
   1.132 +template <class _T1, class _T2>
   1.133 +inline bool _STLP_CALL operator>(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) {
   1.134 +  return __y < __x;
   1.135 +}
   1.136 +
   1.137 +template <class _T1, class _T2>
   1.138 +inline bool _STLP_CALL operator<=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) {
   1.139 +  return !(__y < __x);
   1.140 +}
   1.141 +
   1.142 +template <class _T1, class _T2>
   1.143 +inline bool _STLP_CALL operator>=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) {
   1.144 +  return !(__x < __y);
   1.145 +}
   1.146 +
   1.147 +#endif /* _STLP_USE_SEPARATE_RELOPS_NAMESPACE */
   1.148 +
   1.149 +
   1.150 +#if defined(_STLP_FUNCTION_TMPL_PARTIAL_ORDER) && ! defined (_STLP_NO_EXTENSIONS) && ! defined (__BORLANDC__) && ! defined (__DMC__)
   1.151 +template <class _T1, class _T2, int _Sz>
   1.152 +inline pair<_T1, _T2 const*> make_pair(_T1 const& __x,
   1.153 +                                       _T2 const (&__y)[_Sz])
   1.154 +{
   1.155 +  return pair<_T1, _T2 const*>(__x, static_cast<_T2 const*>(__y));
   1.156 +}
   1.157 +
   1.158 +template <class _T1, class _T2, int _Sz>
   1.159 +inline pair<_T1 const*, _T2> make_pair(_T1 const (&__x)[_Sz],
   1.160 +                                       _T2 const& __y)
   1.161 +{
   1.162 +  return pair<_T1 const*, _T2>(static_cast<_T1 const*>(__x), __y);
   1.163 +}
   1.164 +
   1.165 +template <class _T1, class _T2, int _Sz1, int _Sz2>
   1.166 +inline pair<_T1 const*, _T2 const*> make_pair(_T1 const (&__x)[_Sz1],
   1.167 +                                              _T2 const (&__y)[_Sz2])
   1.168 +{
   1.169 +  return pair<_T1 const*, _T2 const*>(static_cast<_T1 const*>(__x),
   1.170 +                                      static_cast<_T2 const*>(__y));
   1.171 +}
   1.172 +#endif
   1.173 +
   1.174 +template <class _T1, class _T2>
   1.175 +inline pair<_T1, _T2> _STLP_CALL make_pair(const _T1& __x, const _T2& __y)
   1.176 +{
   1.177 +  return pair<_T1, _T2>(__x, __y);
   1.178 +}
   1.179 +
   1.180 +
   1.181 +_STLP_END_NAMESPACE
   1.182 +
   1.183 +# if defined (_STLP_USE_NAMESPACES) || ! defined (_STLP_USE_SEPARATE_RELOPS_NAMESPACE) 
   1.184 +_STLP_BEGIN_RELOPS_NAMESPACE
   1.185 +
   1.186 +template <class _Tp>
   1.187 +inline bool _STLP_CALL operator!=(const _Tp& __x, const _Tp& __y) {
   1.188 +  return !(__x == __y);
   1.189 +}
   1.190 +
   1.191 +template <class _Tp>
   1.192 +inline bool _STLP_CALL operator>(const _Tp& __x, const _Tp& __y) {
   1.193 +  return __y < __x;
   1.194 +}
   1.195 +
   1.196 +template <class _Tp>
   1.197 +inline bool _STLP_CALL operator<=(const _Tp& __x, const _Tp& __y) {
   1.198 +  return !(__y < __x);
   1.199 +}
   1.200 +
   1.201 +template <class _Tp>
   1.202 +inline bool _STLP_CALL  operator>=(const _Tp& __x, const _Tp& __y) {
   1.203 +  return !(__x < __y);
   1.204 +}
   1.205 +
   1.206 +_STLP_END_RELOPS_NAMESPACE
   1.207 +
   1.208 +# endif
   1.209 +
   1.210 +#endif /* _STLP_INTERNAL_PAIR_H */
   1.211 +
   1.212 +// Local Variables:
   1.213 +// mode:C++
   1.214 +// End: