1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/epoc32/include/tools/stlport/stl/_pair.h Wed Mar 31 12:33:34 2010 +0100
1.3 @@ -0,0 +1,181 @@
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 +#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
1.38 +# include <stl/type_traits.h>
1.39 +#endif
1.40 +
1.41 +#ifndef _STLP_MOVE_CONSTRUCT_FWK_H
1.42 +# include <stl/_move_construct_fwk.h>
1.43 +#endif
1.44 +
1.45 +_STLP_BEGIN_NAMESPACE
1.46 +
1.47 +template <class _T1, class _T2>
1.48 +struct pair {
1.49 + typedef _T1 first_type;
1.50 + typedef _T2 second_type;
1.51 +
1.52 + _T1 first;
1.53 + _T2 second;
1.54 +#if defined (_STLP_CONST_CONSTRUCTOR_BUG)
1.55 + pair() {}
1.56 +#else
1.57 + pair() : first(_T1()), second(_T2()) {}
1.58 +#endif
1.59 + pair(const _T1& __a, const _T2& __b) : first(__a), second(__b) {}
1.60 +
1.61 +#if defined (_STLP_MEMBER_TEMPLATES) && !(defined (_STLP_MSVC) && (_STLP_MSVC < 1200))
1.62 + template <class _U1, class _U2>
1.63 + pair(const pair<_U1, _U2>& __p) : first(__p.first), second(__p.second) {}
1.64 +
1.65 + pair(const pair<_T1,_T2>& __o) : first(__o.first), second(__o.second) {}
1.66 +#endif
1.67 +
1.68 + pair(__move_source<pair<_T1, _T2> > src) : first(_STLP_PRIV _AsMoveSource(src.get().first)),
1.69 + second(_STLP_PRIV _AsMoveSource(src.get().second))
1.70 + {}
1.71 +
1.72 + __TRIVIAL_DESTRUCTOR(pair)
1.73 +};
1.74 +
1.75 +template <class _T1, class _T2>
1.76 +inline bool _STLP_CALL operator==(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
1.77 +{ return __x.first == __y.first && __x.second == __y.second; }
1.78 +
1.79 +template <class _T1, class _T2>
1.80 +inline bool _STLP_CALL operator<(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) {
1.81 + return __x.first < __y.first ||
1.82 + (!(__y.first < __x.first) && __x.second < __y.second);
1.83 +}
1.84 +
1.85 +#if defined (_STLP_USE_SEPARATE_RELOPS_NAMESPACE)
1.86 +template <class _T1, class _T2>
1.87 +inline bool _STLP_CALL operator!=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
1.88 +{ return !(__x == __y); }
1.89 +
1.90 +template <class _T1, class _T2>
1.91 +inline bool _STLP_CALL operator>(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
1.92 +{ return __y < __x; }
1.93 +
1.94 +template <class _T1, class _T2>
1.95 +inline bool _STLP_CALL operator<=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
1.96 +{ return !(__y < __x); }
1.97 +
1.98 +template <class _T1, class _T2>
1.99 +inline bool _STLP_CALL operator>=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
1.100 +{ return !(__x < __y); }
1.101 +#endif /* _STLP_USE_SEPARATE_RELOPS_NAMESPACE */
1.102 +
1.103 +#if defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER) && !defined (_STLP_NO_EXTENSIONS)
1.104 +template <class _T1, class _T2, int _Sz>
1.105 +inline pair<_T1, _T2 const*> make_pair(_T1 const& __x,
1.106 + _T2 const (&__y)[_Sz])
1.107 +{ return pair<_T1, _T2 const*>(__x, static_cast<_T2 const*>(__y)); }
1.108 +
1.109 +template <class _T1, class _T2, int _Sz>
1.110 +inline pair<_T1 const*, _T2> make_pair(_T1 const (&__x)[_Sz],
1.111 + _T2 const& __y)
1.112 +{ return pair<_T1 const*, _T2>(static_cast<_T1 const*>(__x), __y); }
1.113 +
1.114 +template <class _T1, class _T2, int _Sz1, int _Sz2>
1.115 +inline pair<_T1 const*, _T2 const*> make_pair(_T1 const (&__x)[_Sz1],
1.116 + _T2 const (&__y)[_Sz2]) {
1.117 + return pair<_T1 const*, _T2 const*>(static_cast<_T1 const*>(__x),
1.118 + static_cast<_T2 const*>(__y));
1.119 +}
1.120 +#endif
1.121 +
1.122 +template <class _T1, class _T2>
1.123 +inline pair<_T1, _T2> _STLP_CALL make_pair(_T1 __x, _T2 __y)
1.124 +{ return pair<_T1, _T2>(__x, __y); }
1.125 +
1.126 +_STLP_END_NAMESPACE
1.127 +
1.128 +#if defined (_STLP_USE_NAMESPACES) || !defined (_STLP_USE_SEPARATE_RELOPS_NAMESPACE)
1.129 +_STLP_BEGIN_RELOPS_NAMESPACE
1.130 +
1.131 +template <class _Tp>
1.132 +inline bool _STLP_CALL operator!=(const _Tp& __x, const _Tp& __y)
1.133 +{ return !(__x == __y); }
1.134 +
1.135 +template <class _Tp>
1.136 +inline bool _STLP_CALL operator>(const _Tp& __x, const _Tp& __y)
1.137 +{ return __y < __x; }
1.138 +
1.139 +template <class _Tp>
1.140 +inline bool _STLP_CALL operator<=(const _Tp& __x, const _Tp& __y)
1.141 +{ return !(__y < __x); }
1.142 +
1.143 +template <class _Tp>
1.144 +inline bool _STLP_CALL operator>=(const _Tp& __x, const _Tp& __y)
1.145 +{ return !(__x < __y); }
1.146 +
1.147 +_STLP_END_RELOPS_NAMESPACE
1.148 +#endif
1.149 +
1.150 +#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
1.151 +_STLP_BEGIN_NAMESPACE
1.152 +
1.153 +template <class _T1, class _T2>
1.154 +struct __type_traits<pair<_T1, _T2> > {
1.155 + typedef __type_traits<_T1> _T1Traits;
1.156 + typedef __type_traits<_T2> _T2Traits;
1.157 + typedef typename _Land2<typename _T1Traits::has_trivial_default_constructor,
1.158 + typename _T2Traits::has_trivial_default_constructor>::_Ret has_trivial_default_constructor;
1.159 + typedef typename _Land2<typename _T1Traits::has_trivial_copy_constructor,
1.160 + typename _T2Traits::has_trivial_copy_constructor>::_Ret has_trivial_copy_constructor;
1.161 + typedef typename _Land2<typename _T1Traits::has_trivial_assignment_operator,
1.162 + typename _T2Traits::has_trivial_assignment_operator>::_Ret has_trivial_assignment_operator;
1.163 + typedef typename _Land2<typename _T1Traits::has_trivial_destructor,
1.164 + typename _T2Traits::has_trivial_destructor>::_Ret has_trivial_destructor;
1.165 + typedef __false_type is_POD_type;
1.166 +
1.167 +#if defined (__BORLANDC__) && (__BORLANDC__ < 0x560)
1.168 + // disable incorrect "dependent type qualifier" error
1.169 + typedef __false_type implemented;
1.170 +#endif
1.171 +};
1.172 +
1.173 +template <class _T1, class _T2>
1.174 +struct __move_traits<pair<_T1, _T2> >
1.175 + : _STLP_PRIV __move_traits_help1<_T1, _T2> {};
1.176 +
1.177 +_STLP_END_NAMESPACE
1.178 +#endif /* _STLP_CLASS_PARTIAL_SPECIALIZATION */
1.179 +
1.180 +#endif /* _STLP_INTERNAL_PAIR_H */
1.181 +
1.182 +// Local Variables:
1.183 +// mode:C++
1.184 +// End: