williamr@2: /* williamr@2: * williamr@2: * Copyright (c) 1994 williamr@2: * Hewlett-Packard Company williamr@2: * williamr@2: * Copyright (c) 1996,1997 williamr@2: * Silicon Graphics Computer Systems, Inc. williamr@2: * williamr@2: * Copyright (c) 1997 williamr@2: * Moscow Center for SPARC Technology williamr@2: * williamr@4: * Copyright (c) 1999 williamr@2: * Boris Fomitchev williamr@2: * williamr@2: * This material is provided "as is", with absolutely no warranty expressed williamr@2: * or implied. Any use is at your own risk. williamr@2: * williamr@4: * Permission to use or copy this software for any purpose is hereby granted williamr@2: * without fee, provided the above notices are retained on all copies. williamr@2: * Permission to modify the code and to distribute modified code is granted, williamr@2: * provided the above notices are retained, and a notice that the code was williamr@2: * modified is included with the above copyright notice. williamr@2: * williamr@2: */ williamr@2: williamr@2: williamr@2: /* NOTE: This is an internal header file, included by other STL headers. williamr@2: * You should not attempt to use it directly. williamr@2: */ williamr@2: williamr@2: #ifndef _STLP_INTERNAL_PAIR_H williamr@2: #define _STLP_INTERNAL_PAIR_H williamr@2: williamr@4: #if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) williamr@4: # include williamr@4: #endif williamr@4: williamr@4: #ifndef _STLP_MOVE_CONSTRUCT_FWK_H williamr@4: # include williamr@4: #endif williamr@2: williamr@2: _STLP_BEGIN_NAMESPACE williamr@2: williamr@2: template williamr@2: struct pair { williamr@2: typedef _T1 first_type; williamr@2: typedef _T2 second_type; williamr@2: williamr@2: _T1 first; williamr@2: _T2 second; williamr@4: #if defined (_STLP_CONST_CONSTRUCTOR_BUG) williamr@2: pair() {} williamr@4: #else williamr@2: pair() : first(_T1()), second(_T2()) {} williamr@4: #endif williamr@2: pair(const _T1& __a, const _T2& __b) : first(__a), second(__b) {} williamr@2: williamr@2: #if defined (_STLP_MEMBER_TEMPLATES) && !(defined (_STLP_MSVC) && (_STLP_MSVC < 1200)) williamr@2: template williamr@2: pair(const pair<_U1, _U2>& __p) : first(__p.first), second(__p.second) {} williamr@2: williamr@2: pair(const pair<_T1,_T2>& __o) : first(__o.first), second(__o.second) {} williamr@2: #endif williamr@4: williamr@4: pair(__move_source > src) : first(_STLP_PRIV _AsMoveSource(src.get().first)), williamr@4: second(_STLP_PRIV _AsMoveSource(src.get().second)) williamr@4: {} williamr@4: williamr@2: __TRIVIAL_DESTRUCTOR(pair) williamr@2: }; williamr@2: williamr@2: template williamr@2: inline bool _STLP_CALL operator==(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) williamr@4: { return __x.first == __y.first && __x.second == __y.second; } williamr@4: williamr@4: template williamr@4: inline bool _STLP_CALL operator<(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) { williamr@4: return __x.first < __y.first || williamr@4: (!(__y.first < __x.first) && __x.second < __y.second); williamr@2: } williamr@2: williamr@4: #if defined (_STLP_USE_SEPARATE_RELOPS_NAMESPACE) williamr@2: template williamr@4: inline bool _STLP_CALL operator!=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) williamr@4: { return !(__x == __y); } williamr@2: williamr@2: template williamr@4: inline bool _STLP_CALL operator>(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) williamr@4: { return __y < __x; } williamr@2: williamr@2: template williamr@4: inline bool _STLP_CALL operator<=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) williamr@4: { return !(__y < __x); } williamr@2: williamr@2: template williamr@4: inline bool _STLP_CALL operator>=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) williamr@4: { return !(__x < __y); } williamr@2: #endif /* _STLP_USE_SEPARATE_RELOPS_NAMESPACE */ williamr@2: williamr@4: #if defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER) && !defined (_STLP_NO_EXTENSIONS) williamr@2: template williamr@2: inline pair<_T1, _T2 const*> make_pair(_T1 const& __x, williamr@2: _T2 const (&__y)[_Sz]) williamr@4: { return pair<_T1, _T2 const*>(__x, static_cast<_T2 const*>(__y)); } williamr@2: williamr@2: template williamr@2: inline pair<_T1 const*, _T2> make_pair(_T1 const (&__x)[_Sz], williamr@2: _T2 const& __y) williamr@4: { return pair<_T1 const*, _T2>(static_cast<_T1 const*>(__x), __y); } williamr@2: williamr@2: template williamr@2: inline pair<_T1 const*, _T2 const*> make_pair(_T1 const (&__x)[_Sz1], williamr@4: _T2 const (&__y)[_Sz2]) { williamr@2: return pair<_T1 const*, _T2 const*>(static_cast<_T1 const*>(__x), williamr@2: static_cast<_T2 const*>(__y)); williamr@2: } williamr@2: #endif williamr@2: williamr@2: template williamr@4: inline pair<_T1, _T2> _STLP_CALL make_pair(_T1 __x, _T2 __y) williamr@4: { return pair<_T1, _T2>(__x, __y); } williamr@2: williamr@2: _STLP_END_NAMESPACE williamr@2: williamr@4: #if defined (_STLP_USE_NAMESPACES) || !defined (_STLP_USE_SEPARATE_RELOPS_NAMESPACE) williamr@2: _STLP_BEGIN_RELOPS_NAMESPACE williamr@2: williamr@2: template williamr@4: inline bool _STLP_CALL operator!=(const _Tp& __x, const _Tp& __y) williamr@4: { return !(__x == __y); } williamr@2: williamr@2: template williamr@4: inline bool _STLP_CALL operator>(const _Tp& __x, const _Tp& __y) williamr@4: { return __y < __x; } williamr@2: williamr@2: template williamr@4: inline bool _STLP_CALL operator<=(const _Tp& __x, const _Tp& __y) williamr@4: { return !(__y < __x); } williamr@2: williamr@2: template williamr@4: inline bool _STLP_CALL operator>=(const _Tp& __x, const _Tp& __y) williamr@4: { return !(__x < __y); } williamr@2: williamr@2: _STLP_END_RELOPS_NAMESPACE williamr@4: #endif williamr@2: williamr@4: #if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) williamr@4: _STLP_BEGIN_NAMESPACE williamr@4: williamr@4: template williamr@4: struct __type_traits > { williamr@4: typedef __type_traits<_T1> _T1Traits; williamr@4: typedef __type_traits<_T2> _T2Traits; williamr@4: typedef typename _Land2::_Ret has_trivial_default_constructor; williamr@4: typedef typename _Land2::_Ret has_trivial_copy_constructor; williamr@4: typedef typename _Land2::_Ret has_trivial_assignment_operator; williamr@4: typedef typename _Land2::_Ret has_trivial_destructor; williamr@4: typedef __false_type is_POD_type; williamr@4: williamr@4: #if defined (__BORLANDC__) && (__BORLANDC__ < 0x560) williamr@4: // disable incorrect "dependent type qualifier" error williamr@4: typedef __false_type implemented; williamr@4: #endif williamr@4: }; williamr@4: williamr@4: template williamr@4: struct __move_traits > williamr@4: : _STLP_PRIV __move_traits_help1<_T1, _T2> {}; williamr@4: williamr@4: _STLP_END_NAMESPACE williamr@4: #endif /* _STLP_CLASS_PARTIAL_SPECIALIZATION */ williamr@2: williamr@2: #endif /* _STLP_INTERNAL_PAIR_H */ williamr@2: williamr@2: // Local Variables: williamr@2: // mode:C++ williamr@2: // End: