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