epoc32/include/tools/stlport/stl/_string_sum.h
branchSymbian3
changeset 4 837f303aceeb
parent 2 2fe1408b6811
     1.1 --- a/epoc32/include/tools/stlport/stl/_string_sum.h	Wed Mar 31 12:27:01 2010 +0100
     1.2 +++ b/epoc32/include/tools/stlport/stl/_string_sum.h	Wed Mar 31 12:33:34 2010 +0100
     1.3 @@ -1,413 +1,413 @@
     1.4 -/*
     1.5 - * Copyright (c) 2003
     1.6 - * Francois Dumont
     1.7 - *
     1.8 - * This material is provided "as is", with absolutely no warranty expressed
     1.9 - * or implied. Any use is at your own risk.
    1.10 - *
    1.11 - * Permission to use or copy this software for any purpose is hereby granted
    1.12 - * without fee, provided the above notices are retained on all copies.
    1.13 - * Permission to modify the code and to distribute modified code is granted,
    1.14 - * provided the above notices are retained, and a notice that the code was
    1.15 - * modified is included with the above copyright notice.
    1.16 - *
    1.17 - */
    1.18 -
    1.19 -#ifndef _STLP_STRING_SUM_H
    1.20 -#define _STLP_STRING_SUM_H
    1.21 -
    1.22 -_STLP_BEGIN_NAMESPACE
    1.23 -
    1.24 -_STLP_MOVE_TO_PRIV_NAMESPACE
    1.25 -
    1.26 -/*char wrapper to simulate basic_string*/
    1.27 -template <class _CharT>
    1.28 -struct __char_wrapper {
    1.29 -  typedef const _CharT& const_reference;
    1.30 -
    1.31 -  __char_wrapper(_CharT __val) : _Val(__val) {}
    1.32 -
    1.33 -  _CharT getValue() const { return _Val; }
    1.34 -  size_t size() const { return 1; }
    1.35 -
    1.36 -  const_reference operator[] (size_t __n) const {
    1.37 -    //To avoid a check on __n we use this strange implementation
    1.38 -    return (&_Val)[__n];
    1.39 -  }
    1.40 -
    1.41 -private:
    1.42 -  _CharT _Val;
    1.43 -};
    1.44 -
    1.45 -/*C string wrapper to simulate basic_string*/
    1.46 -template <class _CharT>
    1.47 -struct __cstr_wrapper {
    1.48 -  typedef const _CharT& const_reference;
    1.49 -
    1.50 -  __cstr_wrapper(const _CharT *__cstr, size_t __size) :
    1.51 -    _CStr(__cstr), _Size(__size) {}
    1.52 -
    1.53 -  const _CharT* c_str() const { return _CStr; }
    1.54 -
    1.55 -  size_t size() const { return _Size; }
    1.56 -
    1.57 -  const_reference operator[] (size_t __n) const { return _CStr[__n]; }
    1.58 -
    1.59 -private:
    1.60 -  const _CharT *_CStr;
    1.61 -  size_t _Size;
    1.62 -};
    1.63 -
    1.64 -/*basic_string wrapper to ensure that we only store a reference to the original string and not copy it*/
    1.65 -template <class _CharT, class _Traits, class _Alloc>
    1.66 -struct __bstr_wrapper {
    1.67 -  typedef const _CharT& const_reference;
    1.68 -  typedef basic_string<_CharT, _Traits, _Alloc> _BString;
    1.69 -
    1.70 -  __bstr_wrapper (_BString const& __s) :
    1.71 -    _BStr(__s) {}
    1.72 -
    1.73 -  size_t size() const { return _BStr.size(); }
    1.74 -
    1.75 -  const_reference operator[] (size_t __n) const { return _BStr[__n]; }
    1.76 -
    1.77 -  _BString const& b_str() const { return _BStr; }
    1.78 -
    1.79 -private:
    1.80 -  _BString const& _BStr;
    1.81 -};
    1.82 -
    1.83 -struct __on_left {};
    1.84 -struct __on_right {};
    1.85 -
    1.86 -template <class _CharT, class _Traits, class _Alloc,
    1.87 -          class _Left, class _Right,
    1.88 -          class _StorageDirection>
    1.89 -class __bstr_sum {
    1.90 -public:
    1.91 -  typedef basic_string<_CharT, _Traits, _Alloc> _BString;
    1.92 -  typedef typename _BString::const_reference const_reference;
    1.93 -  typedef typename _BString::const_iterator const_iterator;
    1.94 -  typedef typename _BString::const_reverse_iterator const_reverse_iterator;
    1.95 -  typedef typename _BString::size_type size_type;
    1.96 -  typedef typename _BString::allocator_type allocator_type;
    1.97 -  typedef __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDirection> _Self;
    1.98 -
    1.99 -  __bstr_sum (_Left const& lhs, _Right const& rhs) :
   1.100 -    _lhs(lhs), _rhs(rhs) {}
   1.101 -
   1.102 -  _Left const& getLhs() const { return _lhs; }
   1.103 -  _Right const& getRhs() const { return _rhs; }
   1.104 -
   1.105 -  allocator_type get_allocator() const { return _M_get_storage(false).get_allocator(); }
   1.106 -
   1.107 -  const_iterator begin() const { return _M_get_storage().begin(); }
   1.108 -  const_iterator end()   const { return _M_get_storage().end(); }
   1.109 -  const_reverse_iterator rbegin() const { return _M_get_storage().rbegin(); }
   1.110 -  const_reverse_iterator rend()   const { return _M_get_storage().rend(); }
   1.111 -
   1.112 -  size_type size() const { return _lhs.size() + _rhs.size(); }
   1.113 -  size_type length() const { return size(); }
   1.114 -
   1.115 -  size_t max_size() const { return _M_get_storage().max_size(); }
   1.116 -  size_type capacity() const { return size(); }
   1.117 -  bool empty() const { return size() == 0; }
   1.118 -
   1.119 -  const_reference operator[](size_t __n) const
   1.120 -  { return (__n < _lhs.size())?_lhs[__n]:_rhs[__n - _lhs.size()]; }
   1.121 -
   1.122 -  const_reference at(size_type __n) const
   1.123 -  { return _M_get_storage().at(__n); }
   1.124 -
   1.125 -  //operator +=
   1.126 -  typedef __bstr_sum<_CharT, _Traits, _Alloc, _Self, __bstr_wrapper<_CharT, _Traits, _Alloc>, __on_left> _BStrOnLeft;
   1.127 -  _BStrOnLeft operator += (const _BString& __s) { return append(__s); }
   1.128 -
   1.129 -  typedef __bstr_sum<_CharT, _Traits, _Alloc, _Self, __cstr_wrapper<_CharT>, __on_left> _CStrOnLeft;
   1.130 -  _CStrOnLeft operator += (const _CharT* __s) { return append(__s); }
   1.131 -
   1.132 -  typedef __bstr_sum<_CharT, _Traits, _Alloc, _Self, __char_wrapper<_CharT>, __on_left> _CharOnLeft;
   1.133 -  _CharOnLeft operator += (_CharT __c) { return _CharOnLeft(*this, __c); }
   1.134 -
   1.135 -  //append
   1.136 -  _BStrOnLeft append (const _BString& __s)
   1.137 -  { return _BStrOnLeft(*this, __s); }
   1.138 -  _BString& append(const _BString& __s, size_type __pos, size_type __n)
   1.139 -  { return _M_get_storage().append(__s, __pos, __n); }
   1.140 -  _CStrOnLeft append(const _CharT* __s) {
   1.141 -    const size_type __n = _Traits::length(__s);
   1.142 -    return _CStrOnLeft(*this, __cstr_wrapper<_CharT>(__s, __n));
   1.143 -  }
   1.144 -  _CStrOnLeft append(const _CharT* __s, size_type __n)
   1.145 -  { return _CStrOnLeft(*this, __cstr_wrapper<_CharT>(__s, __n)); }
   1.146 -  _BString& append(size_type __n, _CharT __c)
   1.147 -  {return _M_get_storage().append(__n, __c);}
   1.148 -  template <class _InputIter>
   1.149 -  _BString& append(_InputIter __first, _InputIter __last)
   1.150 -  {return _M_get_storage().append(__first, __last);}
   1.151 -
   1.152 -  //assign
   1.153 -  _BString& assign(const _BString& __s) {return _M_get_storage().assign(__s);}
   1.154 -  _BString& assign(const _BString& __s, size_type __pos, size_type __n) {return _M_get_storage().assign(__s, __pos, __n);}
   1.155 -  _BString& assign(const _CharT* __s, size_type __n) {return _M_get_storage().assign(__s, __n);}
   1.156 -  _BString& assign(const _CharT* __s) {return _M_get_storage().assign(__s); }
   1.157 -  _BString& assign(size_type __n, _CharT __c) {return _M_get_storage().assign(__n, __c);}
   1.158 -
   1.159 -  //insert
   1.160 -  _BString& insert(size_type __pos, const _BString& __s) {return _M_get_storage().insert(__pos, __s);}
   1.161 -  _BString& insert(size_type __pos, const _BString& __s, size_type __beg, size_type __n)
   1.162 -  {return _M_get_storage().insert(__pos, __s, __beg, __n);}
   1.163 -  _BString& insert(size_type __pos, const _CharT* __s, size_type __n) {return _M_get_storage().insert(__pos, __s, __n);}
   1.164 -  _BString& insert(size_type __pos, const _CharT* __s) {return _M_get_storage().insert(__pos, __s);}
   1.165 -  _BString& insert(size_type __pos, size_type __n, _CharT __c) {return _M_get_storage().insert(__pos, __n, __c);}
   1.166 -
   1.167 -  //erase
   1.168 -  _BString& erase(size_type __pos = 0, size_type __n =_BString::npos) {return _M_get_storage().erase(__pos, __n);}
   1.169 -
   1.170 -  //replace
   1.171 -  _BString& replace(size_type __pos, size_type __n, const _BString& __s)
   1.172 -  {return _M_get_storage().replace(__pos, __n, __s);}
   1.173 -  _BString& replace(size_type __pos1, size_type __n1, const _BString& __s, size_type __pos2, size_type __n2)
   1.174 -  {return _M_get_storage().replace(__pos1, __n1, __s, __pos2, __n2);}
   1.175 -  _BString& replace(size_type __pos, size_type __n1, const _CharT* __s, size_type __n2)
   1.176 -  {return _M_get_storage().replace(__pos, __n1, __s, __n2);}
   1.177 -  _BString& replace(size_type __pos, size_type __n1, const _CharT* __s)
   1.178 -  {return _M_get_storage().replace(__pos, __n1, __s);}
   1.179 -  _BString& replace(size_type __pos, size_type __n1, size_type __n2, _CharT __c)
   1.180 -  {return _M_get_storage().replace(__pos, __n1, __n2, __c);}
   1.181 -
   1.182 -  size_type copy(_CharT* __s, size_type __n, size_type __pos = 0) const
   1.183 -  {return _M_get_storage().copy(__s, __n, __pos);}
   1.184 -
   1.185 -  void swap(_BString& __s)
   1.186 -  {_M_get_storage().swap(__s);}
   1.187 -
   1.188 -  const _CharT* c_str() const { return _M_get_storage().c_str(); }
   1.189 -  const _CharT* data()  const { return _M_get_storage().data(); }
   1.190 -
   1.191 -  //find family
   1.192 -  size_type find(const _BString& __s, size_type __pos = 0) const { return _M_get_storage().find(__s, __pos); }
   1.193 -  size_type find(const _CharT* __s, size_type __pos = 0) const { return _M_get_storage().find(__s, __pos); }
   1.194 -  size_type find(const _CharT* __s, size_type __pos, size_type __n) const { return _M_get_storage().find(__s, __pos, __n); }
   1.195 -  size_type find(_CharT __c, size_type __pos = 0) const { return _M_get_storage().find(__c, __pos); }
   1.196 -
   1.197 -  size_type rfind(const _BString& __s, size_type __pos = _BString::npos) const { return _M_get_storage().rfind(__s, __pos); }
   1.198 -  size_type rfind(const _CharT* __s, size_type __pos = _BString::npos) const { return _M_get_storage().rfind(__s, __pos); }
   1.199 -  size_type rfind(const _CharT* __s, size_type __pos, size_type __n) const { return _M_get_storage().rfind(__s, __pos, __n); }
   1.200 -  size_type rfind(_CharT __c, size_type __pos = _BString::npos) const { return _M_get_storage().rfind(__c, __pos); }
   1.201 -
   1.202 -  size_type find_first_of(const _BString& __s, size_type __pos = 0) const
   1.203 -  { return _M_get_storage().find_first_of(__s, __pos); }
   1.204 -  size_type find_first_of(const _CharT* __s, size_type __pos = 0) const
   1.205 -  { return _M_get_storage().find_first_of(__s, __pos); }
   1.206 -  size_type find_first_of(const _CharT* __s, size_type __pos, size_type __n) const
   1.207 -  { return _M_get_storage().find_first_of(__s, __pos, __n); }
   1.208 -  size_type find_first_of(_CharT __c, size_type __pos = 0) const
   1.209 -  { return _M_get_storage().find(__c, __pos); }
   1.210 -
   1.211 -  size_type find_last_of(const _BString& __s, size_type __pos = _BString::npos) const
   1.212 -  { return _M_get_storage().find_last_of(__s, __pos); }
   1.213 -  size_type find_last_of(const _CharT* __s, size_type __pos = _BString::npos) const
   1.214 -  { return _M_get_storage().find_last_of(__s, __pos); }
   1.215 -  size_type find_last_of(const _CharT* __s, size_type __pos, size_type __n) const
   1.216 -  { return _M_get_storage().find_last_of(__s, __pos, __n); }
   1.217 -  size_type find_last_of(_CharT __c, size_type __pos = _BString::npos) const
   1.218 -  { return _M_get_storage().rfind(__c, __pos); }
   1.219 -
   1.220 -  size_type find_first_not_of(const _BString& __s, size_type __pos = 0) const
   1.221 -  { return _M_get_storage().find_first_not_of(__s, __pos); }
   1.222 -  size_type find_first_not_of(const _CharT* __s, size_type __pos = 0) const
   1.223 -  { return _M_get_storage().find_first_not_of(__s, __pos); }
   1.224 -  size_type find_first_not_of(const _CharT* __s, size_type __pos, size_type __n) const
   1.225 -  { return _M_get_storage().find_first_not_of(__s, __pos, __n); }
   1.226 -  size_type find_first_not_of(_CharT __c, size_type __pos = 0) const
   1.227 -  { return _M_get_storage().find_first_not_of(__c, __pos); }
   1.228 -
   1.229 -  size_type find_last_not_of(const _BString& __s, size_type __pos = _BString::npos) const
   1.230 -  { return _M_get_storage().find_last_not_of(__s, __pos); }
   1.231 -  size_type find_last_not_of(const _CharT* __s, size_type __pos =_BString:: npos) const
   1.232 -  { return _M_get_storage().find_last_not_of(__s, __pos); }
   1.233 -  size_type find_last_not_of(const _CharT* __s, size_type __pos, size_type __n) const
   1.234 -  { return _M_get_storage().find_last_not_of(__s, __pos, __n); }
   1.235 -  size_type find_last_not_of(_CharT __c, size_type __pos = _BString::npos) const
   1.236 -  { return _M_get_storage().find_last_not_of(__c, __pos); }
   1.237 -
   1.238 -  _BString substr(size_type __pos = 0, size_type __n = _BString::npos) const
   1.239 -  { return _M_get_storage().substr(__pos, __n); }
   1.240 -
   1.241 -  //compare
   1.242 -  int compare(const _BString& __s) const
   1.243 -  { return _M_get_storage().compare(__s); }
   1.244 -  int compare(size_type __pos1, size_type __n1, const _Self& __s) const
   1.245 -  { return _M_get_storage().compare(__pos1, __n1, __s); }
   1.246 -  int compare(size_type __pos1, size_type __n1, const _Self& __s, size_type __pos2, size_type __n2) const
   1.247 -  { return _M_get_storage().compare(__pos1, __n1, __s, __pos2, __n2); }
   1.248 -  int compare(const _CharT* __s) const
   1.249 -  { return _M_get_storage().compare(__s); }
   1.250 -  int compare(size_type __pos1, size_type __n1, const _CharT* __s) const
   1.251 -  { return _M_get_storage().compare(__pos1, __n1, __s); }
   1.252 -  int compare(size_type __pos1, size_type __n1, const _CharT* __s, size_type __n2) const
   1.253 -  { return _M_get_storage().compare(__pos1, __n1, __s, __n2); }
   1.254 -
   1.255 -  //Returns the underlying basic_string representation of the template expression
   1.256 -  //The non const method will always initialise it.
   1.257 -  _BString& _M_get_storage()
   1.258 -  { return _rhs._M_get_storage(*this, _StorageDirection()); }
   1.259 -
   1.260 -  template <class _Lhs, class _Rhs, class _StorageDir>
   1.261 -  _BString& _M_get_storage(__bstr_sum<_CharT, _Traits, _Alloc, _Lhs, _Rhs, _StorageDir>  const& __ref,
   1.262 -                           __on_left const& /*StorageDir*/)
   1.263 -  { return _lhs._M_get_storage(__ref); }
   1.264 -
   1.265 -  template <class _Lhs, class _Rhs, class _StorageDir>
   1.266 -  _BString& _M_get_storage(__bstr_sum<_CharT, _Traits, _Alloc, _Lhs, _Rhs, _StorageDir>  const& __ref,
   1.267 -                           __on_right const& /*StorageDir*/)
   1.268 -  { return _rhs._M_get_storage(__ref); }
   1.269 -
   1.270 -  template <class _Lhs, class _Rhs, class _StorageDir>
   1.271 -  _BString& _M_get_storage(__bstr_sum<_CharT, _Traits, _Alloc, _Lhs, _Rhs, _StorageDir>  const& __ref)
   1.272 -  { return _M_get_storage(__ref, _StorageDirection()); }
   1.273 -
   1.274 -  //The const method can be invoked without initialising the basic_string so avoiding dynamic allocation.
   1.275 -  _BString const& _M_get_storage(bool __do_init = true) const
   1.276 -  { return _M_get_storage(*this, __do_init, _StorageDirection()); }
   1.277 -
   1.278 -  template <class _Lhs, class _Rhs, class _StorageDir>
   1.279 -  _BString const& _M_get_storage(__bstr_sum<_CharT, _Traits, _Alloc, _Lhs, _Rhs, _StorageDir>  const& __ref,
   1.280 -                                 bool __do_init, __on_left const& /*StorageDir*/) const
   1.281 -  { return _lhs._M_get_storage(__ref, __do_init); }
   1.282 -
   1.283 -  template <class _Lhs, class _Rhs, class _StorageDir>
   1.284 -  _BString const& _M_get_storage(__bstr_sum<_CharT, _Traits, _Alloc, _Lhs, _Rhs, _StorageDir>  const& __ref,
   1.285 -                                 bool __do_init, __on_right const& /*StorageDir*/) const
   1.286 -  { return _rhs._M_get_storage(__ref, __do_init); }
   1.287 -
   1.288 -  template <class _Lhs, class _Rhs, class _StorageDir>
   1.289 -  _BString const& _M_get_storage(__bstr_sum<_CharT, _Traits, _Alloc, _Lhs, _Rhs, _StorageDir>  const& __ref,
   1.290 -                                 bool __do_init) const
   1.291 -  { return _M_get_storage(__ref, __do_init, _StorageDirection()); }
   1.292 -
   1.293 -private:
   1.294 -  _Left  _lhs;
   1.295 -  _Right _rhs;
   1.296 -};
   1.297 -
   1.298 -/*
   1.299 - * For this operator we choose to use the right part as the storage part
   1.300 - */
   1.301 -template <class _CharT, class _Traits, class _Alloc,
   1.302 -          class _Lh1, class _Rh1, class _StoreDir1,
   1.303 -          class _Lh2, class _Rh2, class _StoreDir2>
   1.304 -inline __bstr_sum<_CharT, _Traits, _Alloc,
   1.305 -                  __bstr_sum<_CharT, _Traits, _Alloc, _Lh1, _Rh1, _StoreDir1>,
   1.306 -                  __bstr_sum<_CharT, _Traits, _Alloc, _Lh2, _Rh2, _StoreDir2>,
   1.307 -                  __on_right> _STLP_CALL
   1.308 -operator + (const __bstr_sum<_CharT, _Traits, _Alloc, _Lh1, _Rh1, _StoreDir1> &__lhs,
   1.309 -            const __bstr_sum<_CharT, _Traits, _Alloc, _Lh2, _Rh2, _StoreDir2> &__rhs) {
   1.310 -  return __bstr_sum<_CharT, _Traits, _Alloc,
   1.311 -                    __bstr_sum<_CharT, _Traits, _Alloc, _Lh1, _Rh1, _StoreDir1>,
   1.312 -                    __bstr_sum<_CharT, _Traits, _Alloc, _Lh2, _Rh2, _StoreDir2>,
   1.313 -                    __on_right>(__lhs, __rhs);
   1.314 -}
   1.315 -
   1.316 -template <class _CharT, class _Traits, class _Alloc,
   1.317 -          class _Lh1, class _Rh1, class _StoreDir1,
   1.318 -          class _Lh2, class _Rh2, class _StoreDir2>
   1.319 -inline bool _STLP_CALL
   1.320 -operator == (const __bstr_sum<_CharT, _Traits, _Alloc, _Lh1, _Rh1, _StoreDir1> &__lhs,
   1.321 -             const __bstr_sum<_CharT, _Traits, _Alloc, _Lh2, _Rh2, _StoreDir2> &__rhs)
   1.322 -{ return (__lhs.size() == __rhs.size()) && (__lhs._M_get_storage() == __rhs._M_get_storage()); }
   1.323 -
   1.324 -template <class _CharT, class _Traits, class _Alloc,
   1.325 -          class _Lh1, class _Rh1, class _StoreDir1,
   1.326 -          class _Lh2, class _Rh2, class _StoreDir2>
   1.327 -inline bool _STLP_CALL
   1.328 -operator < (const __bstr_sum<_CharT, _Traits, _Alloc, _Lh1, _Rh1, _StoreDir1> &__lhs,
   1.329 -            const __bstr_sum<_CharT, _Traits, _Alloc, _Lh2, _Rh2, _StoreDir2> &__rhs)
   1.330 -{ return __lhs._M_get_storage() < __rhs._M_get_storage(); }
   1.331 -
   1.332 -#ifdef _STLP_USE_SEPARATE_RELOPS_NAMESPACE
   1.333 -
   1.334 -template <class _CharT, class _Traits, class _Alloc,
   1.335 -          class _Lh1, class _Rh1, class _StoreDir1,
   1.336 -          class _Lh2, class _Rh2, class _StoreDir2>
   1.337 -inline bool _STLP_CALL
   1.338 -operator != (const __bstr_sum<_CharT, _Traits, _Alloc, _Lh1, _Rh1, _StoreDir1> &__lhs,
   1.339 -             const __bstr_sum<_CharT, _Traits, _Alloc, _Lh2, _Rh2, _StoreDir2> &__rhs)
   1.340 -{ return !(__lhs == __rhs); }
   1.341 -
   1.342 -template <class _CharT, class _Traits, class _Alloc,
   1.343 -          class _Lh1, class _Rh1, class _StoreDir1,
   1.344 -          class _Lh2, class _Rh2, class _StoreDir2>
   1.345 -inline bool _STLP_CALL
   1.346 -operator > (const __bstr_sum<_CharT, _Traits, _Alloc, _Lh1, _Rh1, _StoreDir1> &__lhs,
   1.347 -            const __bstr_sum<_CharT, _Traits, _Alloc, _Lh2, _Rh2, _StoreDir2> &__rhs)
   1.348 -{ return __rhs < __lhs; }
   1.349 -
   1.350 -template <class _CharT, class _Traits, class _Alloc,
   1.351 -          class _Lh1, class _Rh1, class _StoreDir1,
   1.352 -          class _Lh2, class _Rh2, class _StoreDir2>
   1.353 -inline bool _STLP_CALL
   1.354 -operator <= (const __bstr_sum<_CharT, _Traits, _Alloc, _Lh1, _Rh1, _StoreDir1> &__lhs,
   1.355 -             const __bstr_sum<_CharT, _Traits, _Alloc, _Lh2, _Rh2, _StoreDir2> &__rhs)
   1.356 -{ return !(__rhs < __lhs); }
   1.357 -
   1.358 -template <class _CharT, class _Traits, class _Alloc,
   1.359 -          class _Lh1, class _Rh1, class _StoreDir1,
   1.360 -          class _Lh2, class _Rh2, class _StoreDir2>
   1.361 -inline bool _STLP_CALL
   1.362 -operator >= (const __bstr_sum<_CharT, _Traits, _Alloc, _Lh1, _Rh1, _StoreDir1> &__lhs,
   1.363 -             const __bstr_sum<_CharT, _Traits, _Alloc, _Lh2, _Rh2, _StoreDir2> &__rhs)
   1.364 -{ return !(__lhs < __rhs); }
   1.365 -
   1.366 -#endif /* _STLP_USE_SEPARATE_RELOPS_NAMESPACE */
   1.367 -
   1.368 -
   1.369 -/*
   1.370 - * This class will be used to simulate a temporary string that is required for
   1.371 - * a call to the c_str method on the __bstr_sum class.
   1.372 - */
   1.373 -
   1.374 -template <class _CharT, class _Traits, class _Alloc>
   1.375 -struct __sum_storage_elem {
   1.376 -  typedef basic_string<_CharT, _Traits, _Alloc> _BString;
   1.377 -
   1.378 -  __sum_storage_elem(_Alloc __alloc) : _M_init(false), _M_storage(__alloc)
   1.379 -  {}
   1.380 -
   1.381 -  template <class _Left, class _Right, class _StorageDir>
   1.382 -  void _M_Init(__bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir>  const& __ref) const {
   1.383 -    if (!_M_init) {
   1.384 -      _M_storage = __ref;
   1.385 -      _M_init = true;
   1.386 -    }
   1.387 -  }
   1.388 -
   1.389 -  template <class _Left, class _Right, class _StorageDir>
   1.390 -  _BString const& _M_get_storage(__bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir>  const& __ref,
   1.391 -                                 bool __do_init) const {
   1.392 -    if (__do_init) {
   1.393 -      _M_Init(__ref);
   1.394 -    }
   1.395 -    return _M_storage;
   1.396 -  }
   1.397 -  template <class _Left, class _Right, class _StorageDir>
   1.398 -  _BString& _M_get_storage(__bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir>  const& __ref) {
   1.399 -    _M_Init(__ref);
   1.400 -    return _M_storage;
   1.401 -  }
   1.402 -
   1.403 -  size_t size() const { return 0; }
   1.404 -  _CharT const& operator[](size_t __n) const
   1.405 -  { return __STATIC_CAST(_CharT*, 0)[__n]; }
   1.406 -
   1.407 -private:
   1.408 -  mutable bool _M_init;
   1.409 -  mutable basic_string<_CharT, _Traits, _Alloc> _M_storage;
   1.410 -};
   1.411 -
   1.412 -_STLP_MOVE_TO_STD_NAMESPACE
   1.413 -
   1.414 -_STLP_END_NAMESPACE
   1.415 -
   1.416 -#endif /*_STLP_STRING_SUM_H*/
   1.417 +/*
   1.418 + * Copyright (c) 2003
   1.419 + * Francois Dumont
   1.420 + *
   1.421 + * This material is provided "as is", with absolutely no warranty expressed
   1.422 + * or implied. Any use is at your own risk.
   1.423 + *
   1.424 + * Permission to use or copy this software for any purpose is hereby granted
   1.425 + * without fee, provided the above notices are retained on all copies.
   1.426 + * Permission to modify the code and to distribute modified code is granted,
   1.427 + * provided the above notices are retained, and a notice that the code was
   1.428 + * modified is included with the above copyright notice.
   1.429 + *
   1.430 + */
   1.431 +
   1.432 +#ifndef _STLP_STRING_SUM_H
   1.433 +#define _STLP_STRING_SUM_H
   1.434 +
   1.435 +_STLP_BEGIN_NAMESPACE
   1.436 +
   1.437 +_STLP_MOVE_TO_PRIV_NAMESPACE
   1.438 +
   1.439 +/*char wrapper to simulate basic_string*/
   1.440 +template <class _CharT>
   1.441 +struct __char_wrapper {
   1.442 +  typedef const _CharT& const_reference;
   1.443 +
   1.444 +  __char_wrapper(_CharT __val) : _Val(__val) {}
   1.445 +
   1.446 +  _CharT getValue() const { return _Val; }
   1.447 +  size_t size() const { return 1; }
   1.448 +
   1.449 +  const_reference operator[] (size_t __n) const {
   1.450 +    //To avoid a check on __n we use this strange implementation
   1.451 +    return (&_Val)[__n];
   1.452 +  }
   1.453 +
   1.454 +private:
   1.455 +  _CharT _Val;
   1.456 +};
   1.457 +
   1.458 +/*C string wrapper to simulate basic_string*/
   1.459 +template <class _CharT>
   1.460 +struct __cstr_wrapper {
   1.461 +  typedef const _CharT& const_reference;
   1.462 +
   1.463 +  __cstr_wrapper(const _CharT *__cstr, size_t __size) :
   1.464 +    _CStr(__cstr), _Size(__size) {}
   1.465 +
   1.466 +  const _CharT* c_str() const { return _CStr; }
   1.467 +
   1.468 +  size_t size() const { return _Size; }
   1.469 +
   1.470 +  const_reference operator[] (size_t __n) const { return _CStr[__n]; }
   1.471 +
   1.472 +private:
   1.473 +  const _CharT *_CStr;
   1.474 +  size_t _Size;
   1.475 +};
   1.476 +
   1.477 +/*basic_string wrapper to ensure that we only store a reference to the original string and not copy it*/
   1.478 +template <class _CharT, class _Traits, class _Alloc>
   1.479 +struct __bstr_wrapper {
   1.480 +  typedef const _CharT& const_reference;
   1.481 +  typedef basic_string<_CharT, _Traits, _Alloc> _BString;
   1.482 +
   1.483 +  __bstr_wrapper (_BString const& __s) :
   1.484 +    _BStr(__s) {}
   1.485 +
   1.486 +  size_t size() const { return _BStr.size(); }
   1.487 +
   1.488 +  const_reference operator[] (size_t __n) const { return _BStr[__n]; }
   1.489 +
   1.490 +  _BString const& b_str() const { return _BStr; }
   1.491 +
   1.492 +private:
   1.493 +  _BString const& _BStr;
   1.494 +};
   1.495 +
   1.496 +struct __on_left {};
   1.497 +struct __on_right {};
   1.498 +
   1.499 +template <class _CharT, class _Traits, class _Alloc,
   1.500 +          class _Left, class _Right,
   1.501 +          class _StorageDirection>
   1.502 +class __bstr_sum {
   1.503 +public:
   1.504 +  typedef basic_string<_CharT, _Traits, _Alloc> _BString;
   1.505 +  typedef typename _BString::const_reference const_reference;
   1.506 +  typedef typename _BString::const_iterator const_iterator;
   1.507 +  typedef typename _BString::const_reverse_iterator const_reverse_iterator;
   1.508 +  typedef typename _BString::size_type size_type;
   1.509 +  typedef typename _BString::allocator_type allocator_type;
   1.510 +  typedef __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDirection> _Self;
   1.511 +
   1.512 +  __bstr_sum (_Left const& lhs, _Right const& rhs) :
   1.513 +    _lhs(lhs), _rhs(rhs) {}
   1.514 +
   1.515 +  _Left const& getLhs() const { return _lhs; }
   1.516 +  _Right const& getRhs() const { return _rhs; }
   1.517 +
   1.518 +  allocator_type get_allocator() const { return _M_get_storage(false).get_allocator(); }
   1.519 +
   1.520 +  const_iterator begin() const { return _M_get_storage().begin(); }
   1.521 +  const_iterator end()   const { return _M_get_storage().end(); }
   1.522 +  const_reverse_iterator rbegin() const { return _M_get_storage().rbegin(); }
   1.523 +  const_reverse_iterator rend()   const { return _M_get_storage().rend(); }
   1.524 +
   1.525 +  size_type size() const { return _lhs.size() + _rhs.size(); }
   1.526 +  size_type length() const { return size(); }
   1.527 +
   1.528 +  size_t max_size() const { return _M_get_storage().max_size(); }
   1.529 +  size_type capacity() const { return size(); }
   1.530 +  bool empty() const { return size() == 0; }
   1.531 +
   1.532 +  const_reference operator[](size_t __n) const
   1.533 +  { return (__n < _lhs.size())?_lhs[__n]:_rhs[__n - _lhs.size()]; }
   1.534 +
   1.535 +  const_reference at(size_type __n) const
   1.536 +  { return _M_get_storage().at(__n); }
   1.537 +
   1.538 +  //operator +=
   1.539 +  typedef __bstr_sum<_CharT, _Traits, _Alloc, _Self, __bstr_wrapper<_CharT, _Traits, _Alloc>, __on_left> _BStrOnLeft;
   1.540 +  _BStrOnLeft operator += (const _BString& __s) { return append(__s); }
   1.541 +
   1.542 +  typedef __bstr_sum<_CharT, _Traits, _Alloc, _Self, __cstr_wrapper<_CharT>, __on_left> _CStrOnLeft;
   1.543 +  _CStrOnLeft operator += (const _CharT* __s) { return append(__s); }
   1.544 +
   1.545 +  typedef __bstr_sum<_CharT, _Traits, _Alloc, _Self, __char_wrapper<_CharT>, __on_left> _CharOnLeft;
   1.546 +  _CharOnLeft operator += (_CharT __c) { return _CharOnLeft(*this, __c); }
   1.547 +
   1.548 +  //append
   1.549 +  _BStrOnLeft append (const _BString& __s)
   1.550 +  { return _BStrOnLeft(*this, __s); }
   1.551 +  _BString& append(const _BString& __s, size_type __pos, size_type __n)
   1.552 +  { return _M_get_storage().append(__s, __pos, __n); }
   1.553 +  _CStrOnLeft append(const _CharT* __s) {
   1.554 +    const size_type __n = _Traits::length(__s);
   1.555 +    return _CStrOnLeft(*this, __cstr_wrapper<_CharT>(__s, __n));
   1.556 +  }
   1.557 +  _CStrOnLeft append(const _CharT* __s, size_type __n)
   1.558 +  { return _CStrOnLeft(*this, __cstr_wrapper<_CharT>(__s, __n)); }
   1.559 +  _BString& append(size_type __n, _CharT __c)
   1.560 +  {return _M_get_storage().append(__n, __c);}
   1.561 +  template <class _InputIter>
   1.562 +  _BString& append(_InputIter __first, _InputIter __last)
   1.563 +  {return _M_get_storage().append(__first, __last);}
   1.564 +
   1.565 +  //assign
   1.566 +  _BString& assign(const _BString& __s) {return _M_get_storage().assign(__s);}
   1.567 +  _BString& assign(const _BString& __s, size_type __pos, size_type __n) {return _M_get_storage().assign(__s, __pos, __n);}
   1.568 +  _BString& assign(const _CharT* __s, size_type __n) {return _M_get_storage().assign(__s, __n);}
   1.569 +  _BString& assign(const _CharT* __s) {return _M_get_storage().assign(__s); }
   1.570 +  _BString& assign(size_type __n, _CharT __c) {return _M_get_storage().assign(__n, __c);}
   1.571 +
   1.572 +  //insert
   1.573 +  _BString& insert(size_type __pos, const _BString& __s) {return _M_get_storage().insert(__pos, __s);}
   1.574 +  _BString& insert(size_type __pos, const _BString& __s, size_type __beg, size_type __n)
   1.575 +  {return _M_get_storage().insert(__pos, __s, __beg, __n);}
   1.576 +  _BString& insert(size_type __pos, const _CharT* __s, size_type __n) {return _M_get_storage().insert(__pos, __s, __n);}
   1.577 +  _BString& insert(size_type __pos, const _CharT* __s) {return _M_get_storage().insert(__pos, __s);}
   1.578 +  _BString& insert(size_type __pos, size_type __n, _CharT __c) {return _M_get_storage().insert(__pos, __n, __c);}
   1.579 +
   1.580 +  //erase
   1.581 +  _BString& erase(size_type __pos = 0, size_type __n =_BString::npos) {return _M_get_storage().erase(__pos, __n);}
   1.582 +
   1.583 +  //replace
   1.584 +  _BString& replace(size_type __pos, size_type __n, const _BString& __s)
   1.585 +  {return _M_get_storage().replace(__pos, __n, __s);}
   1.586 +  _BString& replace(size_type __pos1, size_type __n1, const _BString& __s, size_type __pos2, size_type __n2)
   1.587 +  {return _M_get_storage().replace(__pos1, __n1, __s, __pos2, __n2);}
   1.588 +  _BString& replace(size_type __pos, size_type __n1, const _CharT* __s, size_type __n2)
   1.589 +  {return _M_get_storage().replace(__pos, __n1, __s, __n2);}
   1.590 +  _BString& replace(size_type __pos, size_type __n1, const _CharT* __s)
   1.591 +  {return _M_get_storage().replace(__pos, __n1, __s);}
   1.592 +  _BString& replace(size_type __pos, size_type __n1, size_type __n2, _CharT __c)
   1.593 +  {return _M_get_storage().replace(__pos, __n1, __n2, __c);}
   1.594 +
   1.595 +  size_type copy(_CharT* __s, size_type __n, size_type __pos = 0) const
   1.596 +  {return _M_get_storage().copy(__s, __n, __pos);}
   1.597 +
   1.598 +  void swap(_BString& __s)
   1.599 +  {_M_get_storage().swap(__s);}
   1.600 +
   1.601 +  const _CharT* c_str() const { return _M_get_storage().c_str(); }
   1.602 +  const _CharT* data()  const { return _M_get_storage().data(); }
   1.603 +
   1.604 +  //find family
   1.605 +  size_type find(const _BString& __s, size_type __pos = 0) const { return _M_get_storage().find(__s, __pos); }
   1.606 +  size_type find(const _CharT* __s, size_type __pos = 0) const { return _M_get_storage().find(__s, __pos); }
   1.607 +  size_type find(const _CharT* __s, size_type __pos, size_type __n) const { return _M_get_storage().find(__s, __pos, __n); }
   1.608 +  size_type find(_CharT __c, size_type __pos = 0) const { return _M_get_storage().find(__c, __pos); }
   1.609 +
   1.610 +  size_type rfind(const _BString& __s, size_type __pos = _BString::npos) const { return _M_get_storage().rfind(__s, __pos); }
   1.611 +  size_type rfind(const _CharT* __s, size_type __pos = _BString::npos) const { return _M_get_storage().rfind(__s, __pos); }
   1.612 +  size_type rfind(const _CharT* __s, size_type __pos, size_type __n) const { return _M_get_storage().rfind(__s, __pos, __n); }
   1.613 +  size_type rfind(_CharT __c, size_type __pos = _BString::npos) const { return _M_get_storage().rfind(__c, __pos); }
   1.614 +
   1.615 +  size_type find_first_of(const _BString& __s, size_type __pos = 0) const
   1.616 +  { return _M_get_storage().find_first_of(__s, __pos); }
   1.617 +  size_type find_first_of(const _CharT* __s, size_type __pos = 0) const
   1.618 +  { return _M_get_storage().find_first_of(__s, __pos); }
   1.619 +  size_type find_first_of(const _CharT* __s, size_type __pos, size_type __n) const
   1.620 +  { return _M_get_storage().find_first_of(__s, __pos, __n); }
   1.621 +  size_type find_first_of(_CharT __c, size_type __pos = 0) const
   1.622 +  { return _M_get_storage().find(__c, __pos); }
   1.623 +
   1.624 +  size_type find_last_of(const _BString& __s, size_type __pos = _BString::npos) const
   1.625 +  { return _M_get_storage().find_last_of(__s, __pos); }
   1.626 +  size_type find_last_of(const _CharT* __s, size_type __pos = _BString::npos) const
   1.627 +  { return _M_get_storage().find_last_of(__s, __pos); }
   1.628 +  size_type find_last_of(const _CharT* __s, size_type __pos, size_type __n) const
   1.629 +  { return _M_get_storage().find_last_of(__s, __pos, __n); }
   1.630 +  size_type find_last_of(_CharT __c, size_type __pos = _BString::npos) const
   1.631 +  { return _M_get_storage().rfind(__c, __pos); }
   1.632 +
   1.633 +  size_type find_first_not_of(const _BString& __s, size_type __pos = 0) const
   1.634 +  { return _M_get_storage().find_first_not_of(__s, __pos); }
   1.635 +  size_type find_first_not_of(const _CharT* __s, size_type __pos = 0) const
   1.636 +  { return _M_get_storage().find_first_not_of(__s, __pos); }
   1.637 +  size_type find_first_not_of(const _CharT* __s, size_type __pos, size_type __n) const
   1.638 +  { return _M_get_storage().find_first_not_of(__s, __pos, __n); }
   1.639 +  size_type find_first_not_of(_CharT __c, size_type __pos = 0) const
   1.640 +  { return _M_get_storage().find_first_not_of(__c, __pos); }
   1.641 +
   1.642 +  size_type find_last_not_of(const _BString& __s, size_type __pos = _BString::npos) const
   1.643 +  { return _M_get_storage().find_last_not_of(__s, __pos); }
   1.644 +  size_type find_last_not_of(const _CharT* __s, size_type __pos =_BString:: npos) const
   1.645 +  { return _M_get_storage().find_last_not_of(__s, __pos); }
   1.646 +  size_type find_last_not_of(const _CharT* __s, size_type __pos, size_type __n) const
   1.647 +  { return _M_get_storage().find_last_not_of(__s, __pos, __n); }
   1.648 +  size_type find_last_not_of(_CharT __c, size_type __pos = _BString::npos) const
   1.649 +  { return _M_get_storage().find_last_not_of(__c, __pos); }
   1.650 +
   1.651 +  _BString substr(size_type __pos = 0, size_type __n = _BString::npos) const
   1.652 +  { return _M_get_storage().substr(__pos, __n); }
   1.653 +
   1.654 +  //compare
   1.655 +  int compare(const _BString& __s) const
   1.656 +  { return _M_get_storage().compare(__s); }
   1.657 +  int compare(size_type __pos1, size_type __n1, const _Self& __s) const
   1.658 +  { return _M_get_storage().compare(__pos1, __n1, __s); }
   1.659 +  int compare(size_type __pos1, size_type __n1, const _Self& __s, size_type __pos2, size_type __n2) const
   1.660 +  { return _M_get_storage().compare(__pos1, __n1, __s, __pos2, __n2); }
   1.661 +  int compare(const _CharT* __s) const
   1.662 +  { return _M_get_storage().compare(__s); }
   1.663 +  int compare(size_type __pos1, size_type __n1, const _CharT* __s) const
   1.664 +  { return _M_get_storage().compare(__pos1, __n1, __s); }
   1.665 +  int compare(size_type __pos1, size_type __n1, const _CharT* __s, size_type __n2) const
   1.666 +  { return _M_get_storage().compare(__pos1, __n1, __s, __n2); }
   1.667 +
   1.668 +  //Returns the underlying basic_string representation of the template expression
   1.669 +  //The non const method will always initialise it.
   1.670 +  _BString& _M_get_storage()
   1.671 +  { return _rhs._M_get_storage(*this, _StorageDirection()); }
   1.672 +
   1.673 +  template <class _Lhs, class _Rhs, class _StorageDir>
   1.674 +  _BString& _M_get_storage(__bstr_sum<_CharT, _Traits, _Alloc, _Lhs, _Rhs, _StorageDir>  const& __ref,
   1.675 +                           __on_left const& /*StorageDir*/)
   1.676 +  { return _lhs._M_get_storage(__ref); }
   1.677 +
   1.678 +  template <class _Lhs, class _Rhs, class _StorageDir>
   1.679 +  _BString& _M_get_storage(__bstr_sum<_CharT, _Traits, _Alloc, _Lhs, _Rhs, _StorageDir>  const& __ref,
   1.680 +                           __on_right const& /*StorageDir*/)
   1.681 +  { return _rhs._M_get_storage(__ref); }
   1.682 +
   1.683 +  template <class _Lhs, class _Rhs, class _StorageDir>
   1.684 +  _BString& _M_get_storage(__bstr_sum<_CharT, _Traits, _Alloc, _Lhs, _Rhs, _StorageDir>  const& __ref)
   1.685 +  { return _M_get_storage(__ref, _StorageDirection()); }
   1.686 +
   1.687 +  //The const method can be invoked without initialising the basic_string so avoiding dynamic allocation.
   1.688 +  _BString const& _M_get_storage(bool __do_init = true) const
   1.689 +  { return _M_get_storage(*this, __do_init, _StorageDirection()); }
   1.690 +
   1.691 +  template <class _Lhs, class _Rhs, class _StorageDir>
   1.692 +  _BString const& _M_get_storage(__bstr_sum<_CharT, _Traits, _Alloc, _Lhs, _Rhs, _StorageDir>  const& __ref,
   1.693 +                                 bool __do_init, __on_left const& /*StorageDir*/) const
   1.694 +  { return _lhs._M_get_storage(__ref, __do_init); }
   1.695 +
   1.696 +  template <class _Lhs, class _Rhs, class _StorageDir>
   1.697 +  _BString const& _M_get_storage(__bstr_sum<_CharT, _Traits, _Alloc, _Lhs, _Rhs, _StorageDir>  const& __ref,
   1.698 +                                 bool __do_init, __on_right const& /*StorageDir*/) const
   1.699 +  { return _rhs._M_get_storage(__ref, __do_init); }
   1.700 +
   1.701 +  template <class _Lhs, class _Rhs, class _StorageDir>
   1.702 +  _BString const& _M_get_storage(__bstr_sum<_CharT, _Traits, _Alloc, _Lhs, _Rhs, _StorageDir>  const& __ref,
   1.703 +                                 bool __do_init) const
   1.704 +  { return _M_get_storage(__ref, __do_init, _StorageDirection()); }
   1.705 +
   1.706 +private:
   1.707 +  _Left  _lhs;
   1.708 +  _Right _rhs;
   1.709 +};
   1.710 +
   1.711 +/*
   1.712 + * For this operator we choose to use the right part as the storage part
   1.713 + */
   1.714 +template <class _CharT, class _Traits, class _Alloc,
   1.715 +          class _Lh1, class _Rh1, class _StoreDir1,
   1.716 +          class _Lh2, class _Rh2, class _StoreDir2>
   1.717 +inline __bstr_sum<_CharT, _Traits, _Alloc,
   1.718 +                  __bstr_sum<_CharT, _Traits, _Alloc, _Lh1, _Rh1, _StoreDir1>,
   1.719 +                  __bstr_sum<_CharT, _Traits, _Alloc, _Lh2, _Rh2, _StoreDir2>,
   1.720 +                  __on_right> _STLP_CALL
   1.721 +operator + (const __bstr_sum<_CharT, _Traits, _Alloc, _Lh1, _Rh1, _StoreDir1> &__lhs,
   1.722 +            const __bstr_sum<_CharT, _Traits, _Alloc, _Lh2, _Rh2, _StoreDir2> &__rhs) {
   1.723 +  return __bstr_sum<_CharT, _Traits, _Alloc,
   1.724 +                    __bstr_sum<_CharT, _Traits, _Alloc, _Lh1, _Rh1, _StoreDir1>,
   1.725 +                    __bstr_sum<_CharT, _Traits, _Alloc, _Lh2, _Rh2, _StoreDir2>,
   1.726 +                    __on_right>(__lhs, __rhs);
   1.727 +}
   1.728 +
   1.729 +template <class _CharT, class _Traits, class _Alloc,
   1.730 +          class _Lh1, class _Rh1, class _StoreDir1,
   1.731 +          class _Lh2, class _Rh2, class _StoreDir2>
   1.732 +inline bool _STLP_CALL
   1.733 +operator == (const __bstr_sum<_CharT, _Traits, _Alloc, _Lh1, _Rh1, _StoreDir1> &__lhs,
   1.734 +             const __bstr_sum<_CharT, _Traits, _Alloc, _Lh2, _Rh2, _StoreDir2> &__rhs)
   1.735 +{ return (__lhs.size() == __rhs.size()) && (__lhs._M_get_storage() == __rhs._M_get_storage()); }
   1.736 +
   1.737 +template <class _CharT, class _Traits, class _Alloc,
   1.738 +          class _Lh1, class _Rh1, class _StoreDir1,
   1.739 +          class _Lh2, class _Rh2, class _StoreDir2>
   1.740 +inline bool _STLP_CALL
   1.741 +operator < (const __bstr_sum<_CharT, _Traits, _Alloc, _Lh1, _Rh1, _StoreDir1> &__lhs,
   1.742 +            const __bstr_sum<_CharT, _Traits, _Alloc, _Lh2, _Rh2, _StoreDir2> &__rhs)
   1.743 +{ return __lhs._M_get_storage() < __rhs._M_get_storage(); }
   1.744 +
   1.745 +#ifdef _STLP_USE_SEPARATE_RELOPS_NAMESPACE
   1.746 +
   1.747 +template <class _CharT, class _Traits, class _Alloc,
   1.748 +          class _Lh1, class _Rh1, class _StoreDir1,
   1.749 +          class _Lh2, class _Rh2, class _StoreDir2>
   1.750 +inline bool _STLP_CALL
   1.751 +operator != (const __bstr_sum<_CharT, _Traits, _Alloc, _Lh1, _Rh1, _StoreDir1> &__lhs,
   1.752 +             const __bstr_sum<_CharT, _Traits, _Alloc, _Lh2, _Rh2, _StoreDir2> &__rhs)
   1.753 +{ return !(__lhs == __rhs); }
   1.754 +
   1.755 +template <class _CharT, class _Traits, class _Alloc,
   1.756 +          class _Lh1, class _Rh1, class _StoreDir1,
   1.757 +          class _Lh2, class _Rh2, class _StoreDir2>
   1.758 +inline bool _STLP_CALL
   1.759 +operator > (const __bstr_sum<_CharT, _Traits, _Alloc, _Lh1, _Rh1, _StoreDir1> &__lhs,
   1.760 +            const __bstr_sum<_CharT, _Traits, _Alloc, _Lh2, _Rh2, _StoreDir2> &__rhs)
   1.761 +{ return __rhs < __lhs; }
   1.762 +
   1.763 +template <class _CharT, class _Traits, class _Alloc,
   1.764 +          class _Lh1, class _Rh1, class _StoreDir1,
   1.765 +          class _Lh2, class _Rh2, class _StoreDir2>
   1.766 +inline bool _STLP_CALL
   1.767 +operator <= (const __bstr_sum<_CharT, _Traits, _Alloc, _Lh1, _Rh1, _StoreDir1> &__lhs,
   1.768 +             const __bstr_sum<_CharT, _Traits, _Alloc, _Lh2, _Rh2, _StoreDir2> &__rhs)
   1.769 +{ return !(__rhs < __lhs); }
   1.770 +
   1.771 +template <class _CharT, class _Traits, class _Alloc,
   1.772 +          class _Lh1, class _Rh1, class _StoreDir1,
   1.773 +          class _Lh2, class _Rh2, class _StoreDir2>
   1.774 +inline bool _STLP_CALL
   1.775 +operator >= (const __bstr_sum<_CharT, _Traits, _Alloc, _Lh1, _Rh1, _StoreDir1> &__lhs,
   1.776 +             const __bstr_sum<_CharT, _Traits, _Alloc, _Lh2, _Rh2, _StoreDir2> &__rhs)
   1.777 +{ return !(__lhs < __rhs); }
   1.778 +
   1.779 +#endif /* _STLP_USE_SEPARATE_RELOPS_NAMESPACE */
   1.780 +
   1.781 +
   1.782 +/*
   1.783 + * This class will be used to simulate a temporary string that is required for
   1.784 + * a call to the c_str method on the __bstr_sum class.
   1.785 + */
   1.786 +
   1.787 +template <class _CharT, class _Traits, class _Alloc>
   1.788 +struct __sum_storage_elem {
   1.789 +  typedef basic_string<_CharT, _Traits, _Alloc> _BString;
   1.790 +
   1.791 +  __sum_storage_elem(_Alloc __alloc) : _M_init(false), _M_storage(__alloc)
   1.792 +  {}
   1.793 +
   1.794 +  template <class _Left, class _Right, class _StorageDir>
   1.795 +  void _M_Init(__bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir>  const& __ref) const {
   1.796 +    if (!_M_init) {
   1.797 +      _M_storage = __ref;
   1.798 +      _M_init = true;
   1.799 +    }
   1.800 +  }
   1.801 +
   1.802 +  template <class _Left, class _Right, class _StorageDir>
   1.803 +  _BString const& _M_get_storage(__bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir>  const& __ref,
   1.804 +                                 bool __do_init) const {
   1.805 +    if (__do_init) {
   1.806 +      _M_Init(__ref);
   1.807 +    }
   1.808 +    return _M_storage;
   1.809 +  }
   1.810 +  template <class _Left, class _Right, class _StorageDir>
   1.811 +  _BString& _M_get_storage(__bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir>  const& __ref) {
   1.812 +    _M_Init(__ref);
   1.813 +    return _M_storage;
   1.814 +  }
   1.815 +
   1.816 +  size_t size() const { return 0; }
   1.817 +  _CharT const& operator[](size_t __n) const
   1.818 +  { return __STATIC_CAST(_CharT*, 0)[__n]; }
   1.819 +
   1.820 +private:
   1.821 +  mutable bool _M_init;
   1.822 +  mutable basic_string<_CharT, _Traits, _Alloc> _M_storage;
   1.823 +};
   1.824 +
   1.825 +_STLP_MOVE_TO_STD_NAMESPACE
   1.826 +
   1.827 +_STLP_END_NAMESPACE
   1.828 +
   1.829 +#endif /*_STLP_STRING_SUM_H*/