epoc32/include/tools/stlport/stl/_string_sum.h
branchSymbian2
changeset 2 2fe1408b6811
child 4 837f303aceeb
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/epoc32/include/tools/stlport/stl/_string_sum.h	Tue Mar 16 16:12:26 2010 +0000
     1.3 @@ -0,0 +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*/