epoc32/include/tools/stlport/stl/_string_operators.h
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:33:34 +0100
branchSymbian3
changeset 4 837f303aceeb
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@4
     1
/*
williamr@4
     2
 * Copyright (c) 2003
williamr@4
     3
 * Francois Dumont
williamr@4
     4
 *
williamr@4
     5
 * This material is provided "as is", with absolutely no warranty expressed
williamr@4
     6
 * or implied. Any use is at your own risk.
williamr@4
     7
 *
williamr@4
     8
 * Permission to use or copy this software for any purpose is hereby granted
williamr@4
     9
 * without fee, provided the above notices are retained on all copies.
williamr@4
    10
 * Permission to modify the code and to distribute modified code is granted,
williamr@4
    11
 * provided the above notices are retained, and a notice that the code was
williamr@4
    12
 * modified is included with the above copyright notice.
williamr@4
    13
 *
williamr@4
    14
 */
williamr@4
    15
williamr@4
    16
#ifndef _STLP_STRING_OPERATORS_H
williamr@4
    17
#define _STLP_STRING_OPERATORS_H
williamr@4
    18
williamr@4
    19
_STLP_BEGIN_NAMESPACE
williamr@4
    20
williamr@4
    21
#if !defined (_STLP_USE_TEMPLATE_EXPRESSION)
williamr@4
    22
williamr@4
    23
#  if defined (__GNUC__) || defined (__MLCCPP__)
williamr@4
    24
#    define _STLP_INIT_AMBIGUITY 1
williamr@4
    25
#  endif
williamr@4
    26
williamr@4
    27
template <class _CharT, class _Traits, class _Alloc>
williamr@4
    28
inline basic_string<_CharT,_Traits,_Alloc> _STLP_CALL
williamr@4
    29
operator+(const basic_string<_CharT,_Traits,_Alloc>& __s,
williamr@4
    30
          const basic_string<_CharT,_Traits,_Alloc>& __y) {
williamr@4
    31
  typedef basic_string<_CharT,_Traits,_Alloc> _Str;
williamr@4
    32
  typedef typename _Str::_Reserve_t _Reserve_t;
williamr@4
    33
#  if defined (_STLP_INIT_AMBIGUITY)
williamr@4
    34
  // gcc counts this as a function
williamr@4
    35
  _Str __result  = _Str(_Reserve_t(), __s.size() + __y.size(), __s.get_allocator());
williamr@4
    36
#  else
williamr@4
    37
  _Str __result(_Reserve_t(), __s.size() + __y.size(), __s.get_allocator());
williamr@4
    38
#  endif
williamr@4
    39
  __result.append(__s);
williamr@4
    40
  __result.append(__y);
williamr@4
    41
  return __result;
williamr@4
    42
}
williamr@4
    43
williamr@4
    44
template <class _CharT, class _Traits, class _Alloc>
williamr@4
    45
inline basic_string<_CharT,_Traits,_Alloc> _STLP_CALL
williamr@4
    46
operator+(const _CharT* __s,
williamr@4
    47
          const basic_string<_CharT,_Traits,_Alloc>& __y) {
williamr@4
    48
  _STLP_FIX_LITERAL_BUG(__s)
williamr@4
    49
  typedef basic_string<_CharT,_Traits,_Alloc> _Str;
williamr@4
    50
  typedef typename _Str::_Reserve_t _Reserve_t;
williamr@4
    51
  const size_t __n = _Traits::length(__s);
williamr@4
    52
#  if defined (_STLP_INIT_AMBIGUITY)
williamr@4
    53
  _Str __result = _Str(_Reserve_t(), __n + __y.size(), __y.get_allocator());
williamr@4
    54
#  else
williamr@4
    55
  _Str __result(_Reserve_t(), __n + __y.size(), __y.get_allocator());
williamr@4
    56
#  endif
williamr@4
    57
  __result.append(__s, __s + __n);
williamr@4
    58
  __result.append(__y);
williamr@4
    59
  return __result;
williamr@4
    60
}
williamr@4
    61
williamr@4
    62
template <class _CharT, class _Traits, class _Alloc>
williamr@4
    63
inline basic_string<_CharT,_Traits,_Alloc> _STLP_CALL
williamr@4
    64
operator+(_CharT __c,
williamr@4
    65
          const basic_string<_CharT,_Traits,_Alloc>& __y) {
williamr@4
    66
  typedef basic_string<_CharT,_Traits,_Alloc> _Str;
williamr@4
    67
  typedef typename _Str::_Reserve_t _Reserve_t;
williamr@4
    68
#  if defined (_STLP_INIT_AMBIGUITY)
williamr@4
    69
  _Str __result = _Str(_Reserve_t(), 1 + __y.size(), __y.get_allocator());
williamr@4
    70
#  else
williamr@4
    71
  _Str __result(_Reserve_t(), 1 + __y.size(), __y.get_allocator());
williamr@4
    72
#  endif
williamr@4
    73
  __result.push_back(__c);
williamr@4
    74
  __result.append(__y);
williamr@4
    75
  return __result;
williamr@4
    76
}
williamr@4
    77
williamr@4
    78
template <class _CharT, class _Traits, class _Alloc>
williamr@4
    79
inline basic_string<_CharT,_Traits,_Alloc> _STLP_CALL
williamr@4
    80
operator+(const basic_string<_CharT,_Traits,_Alloc>& __x,
williamr@4
    81
          const _CharT* __s) {
williamr@4
    82
  _STLP_FIX_LITERAL_BUG(__s)
williamr@4
    83
  typedef basic_string<_CharT,_Traits,_Alloc> _Str;
williamr@4
    84
  typedef typename _Str::_Reserve_t _Reserve_t;
williamr@4
    85
  const size_t __n = _Traits::length(__s);
williamr@4
    86
#  if defined (_STLP_INIT_AMBIGUITY)
williamr@4
    87
  _Str __result = _Str(_Reserve_t(), __x.size() + __n, __x.get_allocator());
williamr@4
    88
#  else
williamr@4
    89
  _Str __result(_Reserve_t(), __x.size() + __n, __x.get_allocator());
williamr@4
    90
#  endif
williamr@4
    91
  __result.append(__x);
williamr@4
    92
  __result.append(__s, __s + __n);
williamr@4
    93
  return __result;
williamr@4
    94
}
williamr@4
    95
williamr@4
    96
template <class _CharT, class _Traits, class _Alloc>
williamr@4
    97
inline basic_string<_CharT,_Traits,_Alloc> _STLP_CALL
williamr@4
    98
operator+(const basic_string<_CharT,_Traits,_Alloc>& __x,
williamr@4
    99
          const _CharT __c) {
williamr@4
   100
  typedef basic_string<_CharT,_Traits,_Alloc> _Str;
williamr@4
   101
  typedef typename _Str::_Reserve_t _Reserve_t;
williamr@4
   102
#  if defined (_STLP_INIT_AMBIGUITY)
williamr@4
   103
  _Str __result = _Str(_Reserve_t(), __x.size() + 1, __x.get_allocator());
williamr@4
   104
#  else
williamr@4
   105
  _Str __result(_Reserve_t(), __x.size() + 1, __x.get_allocator());
williamr@4
   106
#  endif
williamr@4
   107
  __result.append(__x);
williamr@4
   108
  __result.push_back(__c);
williamr@4
   109
  return __result;
williamr@4
   110
}
williamr@4
   111
williamr@4
   112
#  undef _STLP_INIT_AMBIGUITY
williamr@4
   113
williamr@4
   114
#else /* _STLP_USE_TEMPLATE_EXPRESSION */
williamr@4
   115
williamr@4
   116
// addition with basic_string
williamr@4
   117
template <class _CharT, class _Traits, class _Alloc>
williamr@4
   118
inline _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc,
williamr@4
   119
                             _STLP_PRIV __bstr_wrapper<_CharT,_Traits,_Alloc>,
williamr@4
   120
                             _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc,
williamr@4
   121
                                                   _STLP_PRIV __bstr_wrapper<_CharT,_Traits,_Alloc>,
williamr@4
   122
                                                   _STLP_PRIV __sum_storage_elem<_CharT, _Traits, _Alloc>,
williamr@4
   123
                                                   _STLP_PRIV __on_right>,
williamr@4
   124
                             _STLP_PRIV __on_right> _STLP_CALL
williamr@4
   125
operator+(const basic_string<_CharT,_Traits,_Alloc>& __lhs,
williamr@4
   126
          const basic_string<_CharT,_Traits,_Alloc>& __rhs) {
williamr@4
   127
  typedef _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _STLP_PRIV __bstr_wrapper<_CharT,_Traits,_Alloc>,
williamr@4
   128
                                                         _STLP_PRIV __sum_storage_elem<_CharT, _Traits, _Alloc>,
williamr@4
   129
                                                         _STLP_PRIV __on_right> __root_type;
williamr@4
   130
  __root_type __root(__rhs, _STLP_PRIV __sum_storage_elem<_CharT, _Traits, _Alloc>(__lhs.get_allocator()));
williamr@4
   131
  return _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _STLP_PRIV __bstr_wrapper<_CharT,_Traits,_Alloc>,
williamr@4
   132
                                                        __root_type,
williamr@4
   133
                                                        _STLP_PRIV __on_right>(__lhs, __root);
williamr@4
   134
}
williamr@4
   135
williamr@4
   136
template <class _CharT, class _Traits, class _Alloc, class _Left, class _Right, class _StorageDir>
williamr@4
   137
inline _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc,
williamr@4
   138
                             _STLP_PRIV __bstr_wrapper<_CharT,_Traits,_Alloc>,
williamr@4
   139
                             _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir>,
williamr@4
   140
                             _STLP_PRIV __on_right> _STLP_CALL
williamr@4
   141
operator+(const basic_string<_CharT,_Traits,_Alloc>& __lhs,
williamr@4
   142
          const _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir>& __rhs) {
williamr@4
   143
  return _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _STLP_PRIV __bstr_wrapper<_CharT,_Traits,_Alloc>,
williamr@4
   144
                                                        _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir>,
williamr@4
   145
                                                        _STLP_PRIV __on_right>(__lhs, __rhs);
williamr@4
   146
}
williamr@4
   147
williamr@4
   148
template <class _CharT, class _Traits, class _Alloc, class _Left, class _Right, class _StorageDir>
williamr@4
   149
inline _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc,
williamr@4
   150
                             _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir>,
williamr@4
   151
                             _STLP_PRIV __bstr_wrapper<_CharT,_Traits,_Alloc>,
williamr@4
   152
                             _STLP_PRIV __on_left> _STLP_CALL
williamr@4
   153
operator+(const _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir>& __lhs,
williamr@4
   154
          const basic_string<_CharT,_Traits,_Alloc>& __rhs) {
williamr@4
   155
  return _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir>,
williamr@4
   156
                                                        _STLP_PRIV __bstr_wrapper<_CharT,_Traits,_Alloc>,
williamr@4
   157
                                                        _STLP_PRIV __on_left>(__lhs, __rhs);
williamr@4
   158
}
williamr@4
   159
williamr@4
   160
// addition with C string
williamr@4
   161
template <class _CharT, class _Traits, class _Alloc>
williamr@4
   162
inline _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc,
williamr@4
   163
                             _STLP_PRIV __bstr_wrapper<_CharT,_Traits,_Alloc>,
williamr@4
   164
                             _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc,
williamr@4
   165
                                                   _STLP_PRIV __cstr_wrapper<_CharT>,
williamr@4
   166
                                                   _STLP_PRIV __sum_storage_elem<_CharT, _Traits, _Alloc>,
williamr@4
   167
                                                   _STLP_PRIV __on_right>,
williamr@4
   168
                             _STLP_PRIV __on_right> _STLP_CALL
williamr@4
   169
operator+(const basic_string<_CharT,_Traits,_Alloc>& __x,
williamr@4
   170
          const _CharT* __s) {
williamr@4
   171
  const size_t __n = _Traits::length(__s);
williamr@4
   172
  typedef _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _STLP_PRIV __cstr_wrapper<_CharT>,
williamr@4
   173
                                                         _STLP_PRIV __sum_storage_elem<_CharT, _Traits, _Alloc>,
williamr@4
   174
                                                         _STLP_PRIV __on_right> __root_type;
williamr@4
   175
  __root_type __root(_STLP_PRIV __cstr_wrapper<_CharT>(__s, __n), _STLP_PRIV __sum_storage_elem<_CharT, _Traits, _Alloc>(__x.get_allocator()));
williamr@4
   176
  return _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _STLP_PRIV __bstr_wrapper<_CharT,_Traits,_Alloc>,
williamr@4
   177
                                                        __root_type, _STLP_PRIV __on_right>(__x, __root);
williamr@4
   178
}
williamr@4
   179
williamr@4
   180
template <class _CharT, class _Traits, class _Alloc>
williamr@4
   181
inline _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc,
williamr@4
   182
                             _STLP_PRIV __cstr_wrapper<_CharT>,
williamr@4
   183
                             _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc,
williamr@4
   184
                                                   _STLP_PRIV __bstr_wrapper<_CharT,_Traits,_Alloc>,
williamr@4
   185
                                                   _STLP_PRIV __sum_storage_elem<_CharT, _Traits, _Alloc>,
williamr@4
   186
                                                   _STLP_PRIV __on_right>,
williamr@4
   187
                             _STLP_PRIV __on_right> _STLP_CALL
williamr@4
   188
operator+(const _CharT* __s,
williamr@4
   189
          const basic_string<_CharT,_Traits,_Alloc>& __y) {
williamr@4
   190
  const size_t __n = _Traits::length(__s);
williamr@4
   191
  typedef _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _STLP_PRIV __bstr_wrapper<_CharT,_Traits,_Alloc>,
williamr@4
   192
                                                         _STLP_PRIV __sum_storage_elem<_CharT, _Traits, _Alloc>,
williamr@4
   193
                                                         _STLP_PRIV __on_right> __root_type;
williamr@4
   194
  __root_type __root(__y, _STLP_PRIV __sum_storage_elem<_CharT, _Traits, _Alloc>(__y.get_allocator()));
williamr@4
   195
  return _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _STLP_PRIV __cstr_wrapper<_CharT>,
williamr@4
   196
                                                        __root_type,
williamr@4
   197
                                                        _STLP_PRIV __on_right>(_STLP_PRIV __cstr_wrapper<_CharT>(__s, __n), __root);
williamr@4
   198
}
williamr@4
   199
williamr@4
   200
template <class _CharT, class _Traits, class _Alloc, class _Left, class _Right, class _StorageDir>
williamr@4
   201
inline _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc,
williamr@4
   202
                             _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir>,
williamr@4
   203
                             _STLP_PRIV __cstr_wrapper<_CharT>,
williamr@4
   204
                             _STLP_PRIV __on_left> _STLP_CALL
williamr@4
   205
operator+(const _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir>& __x,
williamr@4
   206
          const _CharT* __s) {
williamr@4
   207
  const size_t __n = _Traits::length(__s);
williamr@4
   208
  return _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir>,
williamr@4
   209
                                                        _STLP_PRIV __cstr_wrapper<_CharT>,
williamr@4
   210
                                                        _STLP_PRIV __on_left>(__x, _STLP_PRIV __cstr_wrapper<_CharT>(__s, __n));
williamr@4
   211
}
williamr@4
   212
williamr@4
   213
template <class _CharT, class _Traits, class _Alloc, class _Left, class _Right, class _StorageDir>
williamr@4
   214
inline _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc,
williamr@4
   215
                             _STLP_PRIV __cstr_wrapper<_CharT>,
williamr@4
   216
                             _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir>,
williamr@4
   217
                             _STLP_PRIV __on_right> _STLP_CALL
williamr@4
   218
operator+(const _CharT* __s,
williamr@4
   219
          const _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir>& __y) {
williamr@4
   220
  const size_t __n = _Traits::length(__s);
williamr@4
   221
  return _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _STLP_PRIV __cstr_wrapper<_CharT>,
williamr@4
   222
                                                        _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir>,
williamr@4
   223
                                                        _STLP_PRIV __on_right>(_STLP_PRIV __cstr_wrapper<_CharT>(__s, __n), __y);
williamr@4
   224
}
williamr@4
   225
williamr@4
   226
// addition with char
williamr@4
   227
template <class _CharT, class _Traits, class _Alloc>
williamr@4
   228
inline _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc,
williamr@4
   229
                             _STLP_PRIV __bstr_wrapper<_CharT,_Traits,_Alloc>,
williamr@4
   230
                             _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc,
williamr@4
   231
                                                   _STLP_PRIV __char_wrapper<_CharT>,
williamr@4
   232
                                                   _STLP_PRIV __sum_storage_elem<_CharT, _Traits, _Alloc>,
williamr@4
   233
                                                   _STLP_PRIV __on_right>,
williamr@4
   234
                             _STLP_PRIV __on_right> _STLP_CALL
williamr@4
   235
operator+(const basic_string<_CharT,_Traits,_Alloc>& __x, const _CharT __c) {
williamr@4
   236
  typedef _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _STLP_PRIV __char_wrapper<_CharT>,
williamr@4
   237
                                                         _STLP_PRIV __sum_storage_elem<_CharT, _Traits, _Alloc>,
williamr@4
   238
                                                         _STLP_PRIV __on_right> __root_type;
williamr@4
   239
  __root_type __root(__c, _STLP_PRIV __sum_storage_elem<_CharT, _Traits, _Alloc>(__x.get_allocator()));
williamr@4
   240
  return _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _STLP_PRIV __bstr_wrapper<_CharT,_Traits,_Alloc>,
williamr@4
   241
                                                        __root_type, _STLP_PRIV __on_right>(__x, __root);
williamr@4
   242
}
williamr@4
   243
williamr@4
   244
template <class _CharT, class _Traits, class _Alloc>
williamr@4
   245
inline _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc,
williamr@4
   246
                             _STLP_PRIV __char_wrapper<_CharT>,
williamr@4
   247
                             _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc,
williamr@4
   248
                                                   _STLP_PRIV __bstr_wrapper<_CharT,_Traits,_Alloc>,
williamr@4
   249
                                                   _STLP_PRIV __sum_storage_elem<_CharT, _Traits, _Alloc>,
williamr@4
   250
                                                   _STLP_PRIV __on_right>,
williamr@4
   251
                             _STLP_PRIV __on_right> _STLP_CALL
williamr@4
   252
operator+(const _CharT __c, const basic_string<_CharT,_Traits,_Alloc>& __x) {
williamr@4
   253
  typedef _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _STLP_PRIV __bstr_wrapper<_CharT,_Traits,_Alloc>,
williamr@4
   254
                                                         _STLP_PRIV __sum_storage_elem<_CharT, _Traits, _Alloc>,
williamr@4
   255
                                                         _STLP_PRIV __on_right> __root_type;
williamr@4
   256
  __root_type __root(__x, _STLP_PRIV __sum_storage_elem<_CharT, _Traits, _Alloc>(__x.get_allocator()));
williamr@4
   257
  return _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _STLP_PRIV __char_wrapper<_CharT>,
williamr@4
   258
                                                        __root_type, _STLP_PRIV __on_right>(__c, __root);
williamr@4
   259
}
williamr@4
   260
williamr@4
   261
template <class _CharT, class _Traits, class _Alloc, class _Left, class _Right, class _StorageDir>
williamr@4
   262
inline _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc,
williamr@4
   263
                             _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir>,
williamr@4
   264
                             _STLP_PRIV __char_wrapper<_CharT>,
williamr@4
   265
                             _STLP_PRIV __on_left> _STLP_CALL
williamr@4
   266
operator+(const _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir>& __x, const _CharT __c) {
williamr@4
   267
  return _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir>,
williamr@4
   268
                                                        _STLP_PRIV __char_wrapper<_CharT>, _STLP_PRIV __on_left>(__x, __c);
williamr@4
   269
}
williamr@4
   270
williamr@4
   271
template <class _CharT, class _Traits, class _Alloc, class _Left, class _Right, class _StorageDir>
williamr@4
   272
inline _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _STLP_PRIV __char_wrapper<_CharT>,
williamr@4
   273
                                                      _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir>,
williamr@4
   274
                                                      _STLP_PRIV __on_right> _STLP_CALL
williamr@4
   275
operator+(const _CharT __c, const _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir>& __x) {
williamr@4
   276
  return _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _STLP_PRIV __char_wrapper<_CharT>,
williamr@4
   277
                                                        _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir>,
williamr@4
   278
                                                        _STLP_PRIV __on_right>(__c, __x);
williamr@4
   279
}
williamr@4
   280
williamr@4
   281
#endif /* _STLP_USE_TEMPLATE_EXPRESSION */
williamr@4
   282
williamr@4
   283
// Operator== and operator!=
williamr@4
   284
williamr@4
   285
template <class _CharT, class _Traits, class _Alloc>
williamr@4
   286
inline bool _STLP_CALL
williamr@4
   287
operator==(const basic_string<_CharT,_Traits,_Alloc>& __x,
williamr@4
   288
           const basic_string<_CharT,_Traits,_Alloc>& __y) {
williamr@4
   289
  return __x.size() == __y.size() && _Traits::compare(__x.data(), __y.data(), __x.size()) == 0;
williamr@4
   290
}
williamr@4
   291
williamr@4
   292
#if defined (_STLP_USE_TEMPLATE_EXPRESSION)
williamr@4
   293
template <class _CharT, class _Traits, class _Alloc, class _Lhs, class _Rhs, class _StoreDir>
williamr@4
   294
inline bool _STLP_CALL
williamr@4
   295
operator==(const _STLP_PRIV __bstr_sum<_CharT,_Traits,_Alloc,_Lhs,_Rhs,_StoreDir>& __x,
williamr@4
   296
           const basic_string<_CharT,_Traits,_Alloc>& __y) {
williamr@4
   297
  return __x.size() == __y.size() && _Traits::compare(__x.data(), __y.data(), __x.size()) == 0;
williamr@4
   298
}
williamr@4
   299
williamr@4
   300
template <class _CharT, class _Traits, class _Alloc, class _Lhs, class _Rhs, class _StoreDir>
williamr@4
   301
inline bool _STLP_CALL
williamr@4
   302
operator==(const basic_string<_CharT,_Traits,_Alloc>& __x,
williamr@4
   303
           const _STLP_PRIV __bstr_sum<_CharT,_Traits,_Alloc,_Lhs,_Rhs,_StoreDir>& __y) {
williamr@4
   304
  return __x.size() == __y.size() && _Traits::compare(__x.data(), __y.data(), __x.size()) == 0;
williamr@4
   305
}
williamr@4
   306
#endif /* _STLP_USE_TEMPLATE_EXPRESSION */
williamr@4
   307
williamr@4
   308
williamr@4
   309
template <class _CharT, class _Traits, class _Alloc>
williamr@4
   310
inline bool _STLP_CALL
williamr@4
   311
operator==(const _CharT* __s,
williamr@4
   312
           const basic_string<_CharT,_Traits,_Alloc>& __y) {
williamr@4
   313
  _STLP_FIX_LITERAL_BUG(__s)
williamr@4
   314
  size_t __n = _Traits::length(__s);
williamr@4
   315
  return __n == __y.size() && _Traits::compare(__s, __y.data(), __n) == 0;
williamr@4
   316
}
williamr@4
   317
williamr@4
   318
template <class _CharT, class _Traits, class _Alloc>
williamr@4
   319
inline bool _STLP_CALL
williamr@4
   320
operator==(const basic_string<_CharT,_Traits,_Alloc>& __x,
williamr@4
   321
           const _CharT* __s) {
williamr@4
   322
  _STLP_FIX_LITERAL_BUG(__s)
williamr@4
   323
  size_t __n = _Traits::length(__s);
williamr@4
   324
  return __x.size() == __n && _Traits::compare(__x.data(), __s, __n) == 0;
williamr@4
   325
}
williamr@4
   326
williamr@4
   327
#if defined (_STLP_USE_TEMPLATE_EXPRESSION)
williamr@4
   328
template <class _CharT, class _Traits, class _Alloc, class _Lhs, class _Rhs, class _StoreDir>
williamr@4
   329
inline bool _STLP_CALL
williamr@4
   330
operator==(const _CharT* __s,
williamr@4
   331
           const _STLP_PRIV __bstr_sum<_CharT,_Traits,_Alloc,_Lhs,_Rhs,_StoreDir>& __y) {
williamr@4
   332
  _STLP_FIX_LITERAL_BUG(__s)
williamr@4
   333
  size_t __n = _Traits::length(__s);
williamr@4
   334
  return __n == __y.size() && _Traits::compare(__s, __y.data(), __n) == 0;
williamr@4
   335
}
williamr@4
   336
williamr@4
   337
template <class _CharT, class _Traits, class _Alloc, class _Lhs, class _Rhs, class _StoreDir>
williamr@4
   338
inline bool _STLP_CALL
williamr@4
   339
operator==(const _STLP_PRIV __bstr_sum<_CharT,_Traits,_Alloc,_Lhs,_Rhs,_StoreDir>& __x,
williamr@4
   340
           const _CharT* __s) {
williamr@4
   341
  _STLP_FIX_LITERAL_BUG(__s)
williamr@4
   342
  size_t __n = _Traits::length(__s);
williamr@4
   343
  return __x.size() == __n && _Traits::compare(__x.data(), __s, __n) == 0;
williamr@4
   344
}
williamr@4
   345
#endif /* _STLP_USE_TEMPLATE_EXPRESSION */
williamr@4
   346
williamr@4
   347
// Operator< (and also >, <=, and >=).
williamr@4
   348
williamr@4
   349
template <class _CharT, class _Traits, class _Alloc>
williamr@4
   350
inline bool _STLP_CALL
williamr@4
   351
operator<(const basic_string<_CharT,_Traits,_Alloc>& __x,
williamr@4
   352
          const basic_string<_CharT,_Traits,_Alloc>& __y) {
williamr@4
   353
  return basic_string<_CharT,_Traits,_Alloc> ::_M_compare(__x.begin(), __x.end(),
williamr@4
   354
                                                          __y.begin(), __y.end()) < 0;
williamr@4
   355
}
williamr@4
   356
williamr@4
   357
#if defined (_STLP_USE_TEMPLATE_EXPRESSION)
williamr@4
   358
template <class _CharT, class _Traits, class _Alloc, class _Lhs, class _Rhs, class _StoreDir>
williamr@4
   359
inline bool _STLP_CALL
williamr@4
   360
operator<(const _STLP_PRIV __bstr_sum<_CharT,_Traits,_Alloc,_Lhs,_Rhs,_StoreDir>& __x,
williamr@4
   361
          const basic_string<_CharT,_Traits,_Alloc>& __y) {
williamr@4
   362
  return basic_string<_CharT,_Traits,_Alloc> ::_M_compare(__x.begin(), __x.end(),
williamr@4
   363
                                                          __y.begin(), __y.end()) < 0;
williamr@4
   364
}
williamr@4
   365
williamr@4
   366
template <class _CharT, class _Traits, class _Alloc, class _Lhs, class _Rhs, class _StoreDir>
williamr@4
   367
inline bool _STLP_CALL
williamr@4
   368
operator<(const basic_string<_CharT,_Traits,_Alloc>& __x,
williamr@4
   369
          const _STLP_PRIV __bstr_sum<_CharT,_Traits,_Alloc,_Lhs,_Rhs,_StoreDir>& __y) {
williamr@4
   370
  return basic_string<_CharT,_Traits,_Alloc> ::_M_compare(__x.begin(), __x.end(),
williamr@4
   371
                                                          __y.begin(), __y.end()) < 0;
williamr@4
   372
}
williamr@4
   373
#endif /* _STLP_USE_TEMPLATE_EXPRESSION */
williamr@4
   374
williamr@4
   375
template <class _CharT, class _Traits, class _Alloc>
williamr@4
   376
inline bool _STLP_CALL
williamr@4
   377
operator<(const _CharT* __s,
williamr@4
   378
          const basic_string<_CharT,_Traits,_Alloc>& __y) {
williamr@4
   379
  _STLP_FIX_LITERAL_BUG(__s)
williamr@4
   380
  size_t __n = _Traits::length(__s);
williamr@4
   381
  return basic_string<_CharT,_Traits,_Alloc> ::_M_compare(__s, __s + __n,
williamr@4
   382
                                                          __y.begin(), __y.end()) < 0;
williamr@4
   383
}
williamr@4
   384
williamr@4
   385
template <class _CharT, class _Traits, class _Alloc>
williamr@4
   386
inline bool _STLP_CALL
williamr@4
   387
operator<(const basic_string<_CharT,_Traits,_Alloc>& __x,
williamr@4
   388
          const _CharT* __s) {
williamr@4
   389
  _STLP_FIX_LITERAL_BUG(__s)
williamr@4
   390
  size_t __n = _Traits::length(__s);
williamr@4
   391
  return basic_string<_CharT,_Traits,_Alloc> ::_M_compare(__x.begin(), __x.end(),
williamr@4
   392
                                                          __s, __s + __n) < 0;
williamr@4
   393
}
williamr@4
   394
williamr@4
   395
#if defined (_STLP_USE_TEMPLATE_EXPRESSION)
williamr@4
   396
template <class _CharT, class _Traits, class _Alloc, class _Lhs, class _Rhs, class _StoreDir>
williamr@4
   397
inline bool _STLP_CALL
williamr@4
   398
operator<(const _CharT* __s,
williamr@4
   399
          const _STLP_PRIV __bstr_sum<_CharT,_Traits,_Alloc,_Lhs,_Rhs,_StoreDir>& __y) {
williamr@4
   400
  _STLP_FIX_LITERAL_BUG(__s)
williamr@4
   401
  size_t __n = _Traits::length(__s);
williamr@4
   402
  return basic_string<_CharT,_Traits,_Alloc> ::_M_compare(__s, __s + __n,
williamr@4
   403
                                                          __y.begin(), __y.end()) < 0;
williamr@4
   404
}
williamr@4
   405
williamr@4
   406
template <class _CharT, class _Traits, class _Alloc, class _Lhs, class _Rhs, class _StoreDir>
williamr@4
   407
inline bool _STLP_CALL
williamr@4
   408
operator<(const _STLP_PRIV __bstr_sum<_CharT,_Traits,_Alloc,_Lhs,_Rhs,_StoreDir>& __x,
williamr@4
   409
          const _CharT* __s) {
williamr@4
   410
  _STLP_FIX_LITERAL_BUG(__s)
williamr@4
   411
  size_t __n = _Traits::length(__s);
williamr@4
   412
  return basic_string<_CharT,_Traits,_Alloc> ::_M_compare(__x.begin(), __x.end(),
williamr@4
   413
                                                          __s, __s + __n) < 0;
williamr@4
   414
}
williamr@4
   415
#endif /* _STLP_USE_TEMPLATE_EXPRESSION */
williamr@4
   416
williamr@4
   417
#if defined (_STLP_USE_SEPARATE_RELOPS_NAMESPACE)
williamr@4
   418
williamr@4
   419
/* Only defined if _STLP_USE_SEPARATE_RELOPS_NAMESPACE is defined otherwise
williamr@4
   420
 * it might introduce ambiguity with pure template relational operators
williamr@4
   421
 * from rel_ops namespace.
williamr@4
   422
 */
williamr@4
   423
template <class _CharT, class _Traits, class _Alloc>
williamr@4
   424
inline bool _STLP_CALL
williamr@4
   425
operator!=(const basic_string<_CharT,_Traits,_Alloc>& __x,
williamr@4
   426
           const basic_string<_CharT,_Traits,_Alloc>& __y)
williamr@4
   427
{ return !(__x == __y); }
williamr@4
   428
williamr@4
   429
template <class _CharT, class _Traits, class _Alloc>
williamr@4
   430
inline bool _STLP_CALL
williamr@4
   431
operator>(const basic_string<_CharT,_Traits,_Alloc>& __x,
williamr@4
   432
          const basic_string<_CharT,_Traits,_Alloc>& __y)
williamr@4
   433
{ return __y < __x; }
williamr@4
   434
williamr@4
   435
template <class _CharT, class _Traits, class _Alloc>
williamr@4
   436
inline bool _STLP_CALL
williamr@4
   437
operator<=(const basic_string<_CharT,_Traits,_Alloc>& __x,
williamr@4
   438
           const basic_string<_CharT,_Traits,_Alloc>& __y)
williamr@4
   439
{ return !(__y < __x); }
williamr@4
   440
williamr@4
   441
template <class _CharT, class _Traits, class _Alloc>
williamr@4
   442
inline bool _STLP_CALL
williamr@4
   443
operator>=(const basic_string<_CharT,_Traits,_Alloc>& __x,
williamr@4
   444
           const basic_string<_CharT,_Traits,_Alloc>& __y)
williamr@4
   445
{ return !(__x < __y); }
williamr@4
   446
williamr@4
   447
#  if defined (_STLP_USE_TEMPLATE_EXPRESSION)
williamr@4
   448
template <class _CharT, class _Traits, class _Alloc, class _Lhs, class _Rhs, class _StoreDir>
williamr@4
   449
inline bool _STLP_CALL
williamr@4
   450
operator!=(const _STLP_PRIV __bstr_sum<_CharT,_Traits,_Alloc,_Lhs,_Rhs,_StoreDir>& __x,
williamr@4
   451
           const basic_string<_CharT,_Traits,_Alloc>& __y)
williamr@4
   452
{ return !(__x==__y); }
williamr@4
   453
williamr@4
   454
template <class _CharT, class _Traits, class _Alloc, class _Lhs, class _Rhs, class _StoreDir>
williamr@4
   455
inline bool _STLP_CALL
williamr@4
   456
operator!=(const basic_string<_CharT,_Traits,_Alloc>& __x,
williamr@4
   457
           const _STLP_PRIV __bstr_sum<_CharT,_Traits,_Alloc,_Lhs,_Rhs,_StoreDir>& __y)
williamr@4
   458
{ return !(__x==__y); }
williamr@4
   459
#  endif
williamr@4
   460
williamr@4
   461
#endif /* _STLP_USE_SEPARATE_RELOPS_NAMESPACE */
williamr@4
   462
williamr@4
   463
template <class _CharT, class _Traits, class _Alloc>
williamr@4
   464
inline bool _STLP_CALL
williamr@4
   465
operator!=(const _CharT* __s,
williamr@4
   466
           const basic_string<_CharT,_Traits,_Alloc>& __y) {
williamr@4
   467
  _STLP_FIX_LITERAL_BUG(__s)
williamr@4
   468
  return !(__s == __y);
williamr@4
   469
}
williamr@4
   470
williamr@4
   471
template <class _CharT, class _Traits, class _Alloc>
williamr@4
   472
inline bool _STLP_CALL
williamr@4
   473
operator!=(const basic_string<_CharT,_Traits,_Alloc>& __x,
williamr@4
   474
           const _CharT* __s) {
williamr@4
   475
  _STLP_FIX_LITERAL_BUG(__s)
williamr@4
   476
  return !(__x == __s);
williamr@4
   477
}
williamr@4
   478
williamr@4
   479
#if defined (_STLP_USE_TEMPLATE_EXPRESSION)
williamr@4
   480
template <class _CharT, class _Traits, class _Alloc, class _Lhs, class _Rhs, class _StoreDir>
williamr@4
   481
inline bool _STLP_CALL
williamr@4
   482
operator!=(const _CharT* __s,
williamr@4
   483
           const _STLP_PRIV __bstr_sum<_CharT,_Traits,_Alloc,_Lhs,_Rhs,_StoreDir>& __y) {
williamr@4
   484
  _STLP_FIX_LITERAL_BUG(__s)
williamr@4
   485
  return !(__s == __y);
williamr@4
   486
}
williamr@4
   487
williamr@4
   488
template <class _CharT, class _Traits, class _Alloc, class _Lhs, class _Rhs, class _StoreDir>
williamr@4
   489
inline bool _STLP_CALL
williamr@4
   490
operator!=(const _STLP_PRIV __bstr_sum<_CharT,_Traits,_Alloc,_Lhs,_Rhs,_StoreDir>& __x,
williamr@4
   491
           const _CharT* __s) {
williamr@4
   492
  _STLP_FIX_LITERAL_BUG(__s)
williamr@4
   493
  return !(__x == __s);
williamr@4
   494
}
williamr@4
   495
#endif /* _STLP_USE_TEMPLATE_EXPRESSION */
williamr@4
   496
williamr@4
   497
template <class _CharT, class _Traits, class _Alloc>
williamr@4
   498
inline bool _STLP_CALL
williamr@4
   499
operator>(const _CharT* __s,
williamr@4
   500
          const basic_string<_CharT,_Traits,_Alloc>& __y) {
williamr@4
   501
  _STLP_FIX_LITERAL_BUG(__s)
williamr@4
   502
  return __y < __s;
williamr@4
   503
}
williamr@4
   504
williamr@4
   505
template <class _CharT, class _Traits, class _Alloc>
williamr@4
   506
inline bool _STLP_CALL
williamr@4
   507
operator>(const basic_string<_CharT,_Traits,_Alloc>& __x,
williamr@4
   508
          const _CharT* __s) {
williamr@4
   509
  _STLP_FIX_LITERAL_BUG(__s)
williamr@4
   510
  return __s < __x;
williamr@4
   511
}
williamr@4
   512
williamr@4
   513
#if defined (_STLP_USE_TEMPLATE_EXPRESSION)
williamr@4
   514
template <class _CharT, class _Traits, class _Alloc, class _Lhs, class _Rhs, class _StoreDir>
williamr@4
   515
inline bool _STLP_CALL
williamr@4
   516
operator>(const _CharT* __s,
williamr@4
   517
          const _STLP_PRIV __bstr_sum<_CharT,_Traits,_Alloc,_Lhs,_Rhs,_StoreDir>& __y) {
williamr@4
   518
  _STLP_FIX_LITERAL_BUG(__s)
williamr@4
   519
  return __y < __s;
williamr@4
   520
}
williamr@4
   521
williamr@4
   522
template <class _CharT, class _Traits, class _Alloc, class _Lhs, class _Rhs, class _StoreDir>
williamr@4
   523
inline bool _STLP_CALL
williamr@4
   524
operator>(const _STLP_PRIV __bstr_sum<_CharT,_Traits,_Alloc,_Lhs,_Rhs,_StoreDir>& __x,
williamr@4
   525
          const _CharT* __s) {
williamr@4
   526
  _STLP_FIX_LITERAL_BUG(__s)
williamr@4
   527
  return __s < __x;
williamr@4
   528
}
williamr@4
   529
#endif /* _STLP_USE_TEMPLATE_EXPRESSION */
williamr@4
   530
williamr@4
   531
template <class _CharT, class _Traits, class _Alloc>
williamr@4
   532
inline bool _STLP_CALL
williamr@4
   533
operator<=(const _CharT* __s,
williamr@4
   534
           const basic_string<_CharT,_Traits,_Alloc>& __y) {
williamr@4
   535
  _STLP_FIX_LITERAL_BUG(__s)
williamr@4
   536
  return !(__y < __s);
williamr@4
   537
}
williamr@4
   538
williamr@4
   539
template <class _CharT, class _Traits, class _Alloc>
williamr@4
   540
inline bool _STLP_CALL
williamr@4
   541
operator<=(const basic_string<_CharT,_Traits,_Alloc>& __x,
williamr@4
   542
           const _CharT* __s) {
williamr@4
   543
  _STLP_FIX_LITERAL_BUG(__s)
williamr@4
   544
  return !(__s < __x);
williamr@4
   545
}
williamr@4
   546
williamr@4
   547
#if defined (_STLP_USE_TEMPLATE_EXPRESSION)
williamr@4
   548
template <class _CharT, class _Traits, class _Alloc, class _Lhs, class _Rhs, class _StoreDir>
williamr@4
   549
inline bool _STLP_CALL
williamr@4
   550
operator<=(const _CharT* __s,
williamr@4
   551
           const _STLP_PRIV __bstr_sum<_CharT,_Traits,_Alloc,_Lhs,_Rhs,_StoreDir>& __y) {
williamr@4
   552
  _STLP_FIX_LITERAL_BUG(__s)
williamr@4
   553
  return !(__y < __s);
williamr@4
   554
}
williamr@4
   555
williamr@4
   556
template <class _CharT, class _Traits, class _Alloc, class _Lhs, class _Rhs, class _StoreDir>
williamr@4
   557
inline bool _STLP_CALL
williamr@4
   558
operator<=(const _STLP_PRIV __bstr_sum<_CharT,_Traits,_Alloc,_Lhs,_Rhs,_StoreDir>& __x,
williamr@4
   559
           const _CharT* __s) {
williamr@4
   560
  _STLP_FIX_LITERAL_BUG(__s)
williamr@4
   561
  return !(__s < __x);
williamr@4
   562
}
williamr@4
   563
#endif /* _STLP_USE_TEMPLATE_EXPRESSION */
williamr@4
   564
williamr@4
   565
template <class _CharT, class _Traits, class _Alloc>
williamr@4
   566
inline bool _STLP_CALL
williamr@4
   567
operator>=(const _CharT* __s,
williamr@4
   568
           const basic_string<_CharT,_Traits,_Alloc>& __y) {
williamr@4
   569
  _STLP_FIX_LITERAL_BUG(__s)
williamr@4
   570
  return !(__s < __y);
williamr@4
   571
}
williamr@4
   572
williamr@4
   573
template <class _CharT, class _Traits, class _Alloc>
williamr@4
   574
inline bool _STLP_CALL
williamr@4
   575
operator>=(const basic_string<_CharT,_Traits,_Alloc>& __x,
williamr@4
   576
           const _CharT* __s) {
williamr@4
   577
  _STLP_FIX_LITERAL_BUG(__s)
williamr@4
   578
  return !(__x < __s);
williamr@4
   579
}
williamr@4
   580
williamr@4
   581
#if defined (_STLP_USE_TEMPLATE_EXPRESSION)
williamr@4
   582
template <class _CharT, class _Traits, class _Alloc, class _Lhs, class _Rhs, class _StoreDir>
williamr@4
   583
inline bool _STLP_CALL
williamr@4
   584
operator>=(const _CharT* __s,
williamr@4
   585
           const _STLP_PRIV __bstr_sum<_CharT,_Traits,_Alloc,_Lhs,_Rhs,_StoreDir>& __y) {
williamr@4
   586
  _STLP_FIX_LITERAL_BUG(__s)
williamr@4
   587
  return !(__s < __y);
williamr@4
   588
}
williamr@4
   589
williamr@4
   590
template <class _CharT, class _Traits, class _Alloc, class _Lhs, class _Rhs, class _StoreDir>
williamr@4
   591
inline bool _STLP_CALL
williamr@4
   592
operator>=(const _STLP_PRIV __bstr_sum<_CharT,_Traits,_Alloc,_Lhs,_Rhs,_StoreDir>& __x,
williamr@4
   593
           const _CharT* __s) {
williamr@4
   594
  _STLP_FIX_LITERAL_BUG(__s)
williamr@4
   595
  return !(__x < __s);
williamr@4
   596
}
williamr@4
   597
#endif /* _STLP_USE_TEMPLATE_EXPRESSION */
williamr@4
   598
williamr@4
   599
_STLP_END_NAMESPACE
williamr@4
   600
williamr@4
   601
#endif /* _STLP_STRING_OPERATORS_H */
williamr@4
   602