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