epoc32/include/stdapis/stlportv5/stl/_pair.h
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:33:34 +0100
branchSymbian3
changeset 4 837f303aceeb
parent 3 e1b950c65cb4
permissions -rw-r--r--
Current Symbian^3 public API header files (from PDK 3.0.h)
This is the epoc32/include tree with the "platform" subtrees removed, and
all but a selected few mbg and rsg files removed.
williamr@2
     1
/*
williamr@2
     2
 *
williamr@2
     3
 * Copyright (c) 1994
williamr@2
     4
 * Hewlett-Packard Company
williamr@2
     5
 *
williamr@2
     6
 * Copyright (c) 1996,1997
williamr@2
     7
 * Silicon Graphics Computer Systems, Inc.
williamr@2
     8
 *
williamr@2
     9
 * Copyright (c) 1997
williamr@2
    10
 * Moscow Center for SPARC Technology
williamr@2
    11
 *
williamr@4
    12
 * Copyright (c) 1999
williamr@2
    13
 * Boris Fomitchev
williamr@2
    14
 *
williamr@2
    15
 * This material is provided "as is", with absolutely no warranty expressed
williamr@2
    16
 * or implied. Any use is at your own risk.
williamr@2
    17
 *
williamr@4
    18
 * Permission to use or copy this software for any purpose is hereby granted
williamr@2
    19
 * without fee, provided the above notices are retained on all copies.
williamr@2
    20
 * Permission to modify the code and to distribute modified code is granted,
williamr@2
    21
 * provided the above notices are retained, and a notice that the code was
williamr@2
    22
 * modified is included with the above copyright notice.
williamr@2
    23
 *
williamr@2
    24
 */
williamr@2
    25
williamr@2
    26
williamr@2
    27
/* NOTE: This is an internal header file, included by other STL headers.
williamr@2
    28
 *   You should not attempt to use it directly.
williamr@2
    29
 */
williamr@2
    30
williamr@2
    31
#ifndef _STLP_INTERNAL_PAIR_H
williamr@2
    32
#define _STLP_INTERNAL_PAIR_H
williamr@2
    33
williamr@4
    34
#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
williamr@4
    35
#  include <stl/type_traits.h>
williamr@4
    36
#endif
williamr@4
    37
williamr@4
    38
#ifndef _STLP_MOVE_CONSTRUCT_FWK_H
williamr@4
    39
#  include <stl/_move_construct_fwk.h>
williamr@4
    40
#endif
williamr@2
    41
williamr@2
    42
_STLP_BEGIN_NAMESPACE
williamr@2
    43
williamr@2
    44
template <class _T1, class _T2>
williamr@2
    45
struct pair {
williamr@2
    46
  typedef _T1 first_type;
williamr@2
    47
  typedef _T2 second_type;
williamr@2
    48
williamr@2
    49
  _T1 first;
williamr@2
    50
  _T2 second;
williamr@4
    51
#if defined (_STLP_CONST_CONSTRUCTOR_BUG)
williamr@2
    52
  pair() {}
williamr@4
    53
#else
williamr@2
    54
  pair() : first(_T1()), second(_T2()) {}
williamr@4
    55
#endif
williamr@2
    56
  pair(const _T1& __a, const _T2& __b) : first(__a), second(__b) {}
williamr@2
    57
williamr@2
    58
#if defined (_STLP_MEMBER_TEMPLATES) && !(defined (_STLP_MSVC) && (_STLP_MSVC < 1200))
williamr@2
    59
  template <class _U1, class _U2>
williamr@2
    60
  pair(const pair<_U1, _U2>& __p) : first(__p.first), second(__p.second) {}
williamr@2
    61
williamr@2
    62
  pair(const pair<_T1,_T2>& __o) : first(__o.first), second(__o.second) {}
williamr@2
    63
#endif
williamr@4
    64
williamr@4
    65
  pair(__move_source<pair<_T1, _T2> > src) : first(_STLP_PRIV _AsMoveSource(src.get().first)),
williamr@4
    66
                                             second(_STLP_PRIV _AsMoveSource(src.get().second))
williamr@4
    67
  {}
williamr@4
    68
williamr@2
    69
  __TRIVIAL_DESTRUCTOR(pair)
williamr@2
    70
};
williamr@2
    71
williamr@2
    72
template <class _T1, class _T2>
williamr@2
    73
inline bool _STLP_CALL operator==(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
williamr@4
    74
{ return __x.first == __y.first && __x.second == __y.second; }
williamr@4
    75
williamr@4
    76
template <class _T1, class _T2>
williamr@4
    77
inline bool _STLP_CALL operator<(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) {
williamr@4
    78
  return __x.first < __y.first ||
williamr@4
    79
         (!(__y.first < __x.first) && __x.second < __y.second);
williamr@2
    80
}
williamr@2
    81
williamr@4
    82
#if defined (_STLP_USE_SEPARATE_RELOPS_NAMESPACE)
williamr@2
    83
template <class _T1, class _T2>
williamr@4
    84
inline bool _STLP_CALL operator!=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
williamr@4
    85
{ return !(__x == __y); }
williamr@2
    86
williamr@2
    87
template <class _T1, class _T2>
williamr@4
    88
inline bool _STLP_CALL operator>(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
williamr@4
    89
{ return __y < __x; }
williamr@2
    90
williamr@2
    91
template <class _T1, class _T2>
williamr@4
    92
inline bool _STLP_CALL operator<=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
williamr@4
    93
{ return !(__y < __x); }
williamr@2
    94
williamr@2
    95
template <class _T1, class _T2>
williamr@4
    96
inline bool _STLP_CALL operator>=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
williamr@4
    97
{ return !(__x < __y); }
williamr@2
    98
#endif /* _STLP_USE_SEPARATE_RELOPS_NAMESPACE */
williamr@2
    99
williamr@4
   100
#if defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER) && !defined (_STLP_NO_EXTENSIONS)
williamr@2
   101
template <class _T1, class _T2, int _Sz>
williamr@2
   102
inline pair<_T1, _T2 const*> make_pair(_T1 const& __x,
williamr@2
   103
                                       _T2 const (&__y)[_Sz])
williamr@4
   104
{ return pair<_T1, _T2 const*>(__x, static_cast<_T2 const*>(__y)); }
williamr@2
   105
williamr@2
   106
template <class _T1, class _T2, int _Sz>
williamr@2
   107
inline pair<_T1 const*, _T2> make_pair(_T1 const (&__x)[_Sz],
williamr@2
   108
                                       _T2 const& __y)
williamr@4
   109
{ return pair<_T1 const*, _T2>(static_cast<_T1 const*>(__x), __y); }
williamr@2
   110
williamr@2
   111
template <class _T1, class _T2, int _Sz1, int _Sz2>
williamr@2
   112
inline pair<_T1 const*, _T2 const*> make_pair(_T1 const (&__x)[_Sz1],
williamr@4
   113
                                              _T2 const (&__y)[_Sz2]) {
williamr@2
   114
  return pair<_T1 const*, _T2 const*>(static_cast<_T1 const*>(__x),
williamr@2
   115
                                      static_cast<_T2 const*>(__y));
williamr@2
   116
}
williamr@2
   117
#endif
williamr@2
   118
williamr@2
   119
template <class _T1, class _T2>
williamr@4
   120
inline pair<_T1, _T2> _STLP_CALL make_pair(_T1 __x, _T2 __y)
williamr@4
   121
{ return pair<_T1, _T2>(__x, __y); }
williamr@2
   122
williamr@2
   123
_STLP_END_NAMESPACE
williamr@2
   124
williamr@4
   125
#if defined (_STLP_USE_NAMESPACES) || !defined (_STLP_USE_SEPARATE_RELOPS_NAMESPACE)
williamr@2
   126
_STLP_BEGIN_RELOPS_NAMESPACE
williamr@2
   127
williamr@2
   128
template <class _Tp>
williamr@4
   129
inline bool _STLP_CALL operator!=(const _Tp& __x, const _Tp& __y)
williamr@4
   130
{ return !(__x == __y); }
williamr@2
   131
williamr@2
   132
template <class _Tp>
williamr@4
   133
inline bool _STLP_CALL operator>(const _Tp& __x, const _Tp& __y)
williamr@4
   134
{ return __y < __x; }
williamr@2
   135
williamr@2
   136
template <class _Tp>
williamr@4
   137
inline bool _STLP_CALL operator<=(const _Tp& __x, const _Tp& __y)
williamr@4
   138
{ return !(__y < __x); }
williamr@2
   139
williamr@2
   140
template <class _Tp>
williamr@4
   141
inline bool _STLP_CALL  operator>=(const _Tp& __x, const _Tp& __y)
williamr@4
   142
{ return !(__x < __y); }
williamr@2
   143
williamr@2
   144
_STLP_END_RELOPS_NAMESPACE
williamr@4
   145
#endif
williamr@2
   146
williamr@4
   147
#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
williamr@4
   148
_STLP_BEGIN_NAMESPACE
williamr@4
   149
williamr@4
   150
template <class _T1, class _T2>
williamr@4
   151
struct __type_traits<pair<_T1, _T2> > {
williamr@4
   152
  typedef __type_traits<_T1> _T1Traits;
williamr@4
   153
  typedef __type_traits<_T2> _T2Traits;
williamr@4
   154
  typedef typename _Land2<typename _T1Traits::has_trivial_default_constructor,
williamr@4
   155
                          typename _T2Traits::has_trivial_default_constructor>::_Ret has_trivial_default_constructor;
williamr@4
   156
  typedef typename _Land2<typename _T1Traits::has_trivial_copy_constructor,
williamr@4
   157
                          typename _T2Traits::has_trivial_copy_constructor>::_Ret has_trivial_copy_constructor;
williamr@4
   158
  typedef typename _Land2<typename _T1Traits::has_trivial_assignment_operator,
williamr@4
   159
                          typename _T2Traits::has_trivial_assignment_operator>::_Ret has_trivial_assignment_operator;
williamr@4
   160
  typedef typename _Land2<typename _T1Traits::has_trivial_destructor,
williamr@4
   161
                          typename _T2Traits::has_trivial_destructor>::_Ret has_trivial_destructor;
williamr@4
   162
  typedef __false_type is_POD_type;
williamr@4
   163
williamr@4
   164
#if defined (__BORLANDC__) && (__BORLANDC__ < 0x560)
williamr@4
   165
  // disable incorrect "dependent type qualifier" error
williamr@4
   166
  typedef __false_type implemented;
williamr@4
   167
#endif
williamr@4
   168
};
williamr@4
   169
williamr@4
   170
template <class _T1, class _T2>
williamr@4
   171
struct __move_traits<pair<_T1, _T2> >
williamr@4
   172
  : _STLP_PRIV __move_traits_help1<_T1, _T2> {};
williamr@4
   173
williamr@4
   174
_STLP_END_NAMESPACE
williamr@4
   175
#endif /* _STLP_CLASS_PARTIAL_SPECIALIZATION */
williamr@2
   176
williamr@2
   177
#endif /* _STLP_INTERNAL_PAIR_H */
williamr@2
   178
williamr@2
   179
// Local Variables:
williamr@2
   180
// mode:C++
williamr@2
   181
// End: