1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/epoc32/include/stdapis/stlportv5/stl/_string_operators.h Wed Mar 31 12:27:01 2010 +0100
1.3 @@ -0,0 +1,602 @@
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_OPERATORS_H
1.20 +#define _STLP_STRING_OPERATORS_H
1.21 +
1.22 +_STLP_BEGIN_NAMESPACE
1.23 +
1.24 +#if !defined (_STLP_USE_TEMPLATE_EXPRESSION)
1.25 +
1.26 +# if defined (__GNUC__) || defined (__MLCCPP__)
1.27 +# define _STLP_INIT_AMBIGUITY 1
1.28 +# endif
1.29 +
1.30 +template <class _CharT, class _Traits, class _Alloc>
1.31 +inline basic_string<_CharT,_Traits,_Alloc> _STLP_CALL
1.32 +operator+(const basic_string<_CharT,_Traits,_Alloc>& __s,
1.33 + const basic_string<_CharT,_Traits,_Alloc>& __y) {
1.34 + typedef basic_string<_CharT,_Traits,_Alloc> _Str;
1.35 + typedef typename _Str::_Reserve_t _Reserve_t;
1.36 +# if defined (_STLP_INIT_AMBIGUITY)
1.37 + // gcc counts this as a function
1.38 + _Str __result = _Str(_Reserve_t(), __s.size() + __y.size(), __s.get_allocator());
1.39 +# else
1.40 + _Str __result(_Reserve_t(), __s.size() + __y.size(), __s.get_allocator());
1.41 +# endif
1.42 + __result.append(__s);
1.43 + __result.append(__y);
1.44 + return __result;
1.45 +}
1.46 +
1.47 +template <class _CharT, class _Traits, class _Alloc>
1.48 +inline basic_string<_CharT,_Traits,_Alloc> _STLP_CALL
1.49 +operator+(const _CharT* __s,
1.50 + const basic_string<_CharT,_Traits,_Alloc>& __y) {
1.51 + _STLP_FIX_LITERAL_BUG(__s)
1.52 + typedef basic_string<_CharT,_Traits,_Alloc> _Str;
1.53 + typedef typename _Str::_Reserve_t _Reserve_t;
1.54 + const size_t __n = _Traits::length(__s);
1.55 +# if defined (_STLP_INIT_AMBIGUITY)
1.56 + _Str __result = _Str(_Reserve_t(), __n + __y.size(), __y.get_allocator());
1.57 +# else
1.58 + _Str __result(_Reserve_t(), __n + __y.size(), __y.get_allocator());
1.59 +# endif
1.60 + __result.append(__s, __s + __n);
1.61 + __result.append(__y);
1.62 + return __result;
1.63 +}
1.64 +
1.65 +template <class _CharT, class _Traits, class _Alloc>
1.66 +inline basic_string<_CharT,_Traits,_Alloc> _STLP_CALL
1.67 +operator+(_CharT __c,
1.68 + const basic_string<_CharT,_Traits,_Alloc>& __y) {
1.69 + typedef basic_string<_CharT,_Traits,_Alloc> _Str;
1.70 + typedef typename _Str::_Reserve_t _Reserve_t;
1.71 +# if defined (_STLP_INIT_AMBIGUITY)
1.72 + _Str __result = _Str(_Reserve_t(), 1 + __y.size(), __y.get_allocator());
1.73 +# else
1.74 + _Str __result(_Reserve_t(), 1 + __y.size(), __y.get_allocator());
1.75 +# endif
1.76 + __result.push_back(__c);
1.77 + __result.append(__y);
1.78 + return __result;
1.79 +}
1.80 +
1.81 +template <class _CharT, class _Traits, class _Alloc>
1.82 +inline basic_string<_CharT,_Traits,_Alloc> _STLP_CALL
1.83 +operator+(const basic_string<_CharT,_Traits,_Alloc>& __x,
1.84 + const _CharT* __s) {
1.85 + _STLP_FIX_LITERAL_BUG(__s)
1.86 + typedef basic_string<_CharT,_Traits,_Alloc> _Str;
1.87 + typedef typename _Str::_Reserve_t _Reserve_t;
1.88 + const size_t __n = _Traits::length(__s);
1.89 +# if defined (_STLP_INIT_AMBIGUITY)
1.90 + _Str __result = _Str(_Reserve_t(), __x.size() + __n, __x.get_allocator());
1.91 +# else
1.92 + _Str __result(_Reserve_t(), __x.size() + __n, __x.get_allocator());
1.93 +# endif
1.94 + __result.append(__x);
1.95 + __result.append(__s, __s + __n);
1.96 + return __result;
1.97 +}
1.98 +
1.99 +template <class _CharT, class _Traits, class _Alloc>
1.100 +inline basic_string<_CharT,_Traits,_Alloc> _STLP_CALL
1.101 +operator+(const basic_string<_CharT,_Traits,_Alloc>& __x,
1.102 + const _CharT __c) {
1.103 + typedef basic_string<_CharT,_Traits,_Alloc> _Str;
1.104 + typedef typename _Str::_Reserve_t _Reserve_t;
1.105 +# if defined (_STLP_INIT_AMBIGUITY)
1.106 + _Str __result = _Str(_Reserve_t(), __x.size() + 1, __x.get_allocator());
1.107 +# else
1.108 + _Str __result(_Reserve_t(), __x.size() + 1, __x.get_allocator());
1.109 +# endif
1.110 + __result.append(__x);
1.111 + __result.push_back(__c);
1.112 + return __result;
1.113 +}
1.114 +
1.115 +# undef _STLP_INIT_AMBIGUITY
1.116 +
1.117 +#else /* _STLP_USE_TEMPLATE_EXPRESSION */
1.118 +
1.119 +// addition with basic_string
1.120 +template <class _CharT, class _Traits, class _Alloc>
1.121 +inline _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc,
1.122 + _STLP_PRIV __bstr_wrapper<_CharT,_Traits,_Alloc>,
1.123 + _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc,
1.124 + _STLP_PRIV __bstr_wrapper<_CharT,_Traits,_Alloc>,
1.125 + _STLP_PRIV __sum_storage_elem<_CharT, _Traits, _Alloc>,
1.126 + _STLP_PRIV __on_right>,
1.127 + _STLP_PRIV __on_right> _STLP_CALL
1.128 +operator+(const basic_string<_CharT,_Traits,_Alloc>& __lhs,
1.129 + const basic_string<_CharT,_Traits,_Alloc>& __rhs) {
1.130 + typedef _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _STLP_PRIV __bstr_wrapper<_CharT,_Traits,_Alloc>,
1.131 + _STLP_PRIV __sum_storage_elem<_CharT, _Traits, _Alloc>,
1.132 + _STLP_PRIV __on_right> __root_type;
1.133 + __root_type __root(__rhs, _STLP_PRIV __sum_storage_elem<_CharT, _Traits, _Alloc>(__lhs.get_allocator()));
1.134 + return _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _STLP_PRIV __bstr_wrapper<_CharT,_Traits,_Alloc>,
1.135 + __root_type,
1.136 + _STLP_PRIV __on_right>(__lhs, __root);
1.137 +}
1.138 +
1.139 +template <class _CharT, class _Traits, class _Alloc, class _Left, class _Right, class _StorageDir>
1.140 +inline _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc,
1.141 + _STLP_PRIV __bstr_wrapper<_CharT,_Traits,_Alloc>,
1.142 + _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir>,
1.143 + _STLP_PRIV __on_right> _STLP_CALL
1.144 +operator+(const basic_string<_CharT,_Traits,_Alloc>& __lhs,
1.145 + const _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir>& __rhs) {
1.146 + return _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _STLP_PRIV __bstr_wrapper<_CharT,_Traits,_Alloc>,
1.147 + _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir>,
1.148 + _STLP_PRIV __on_right>(__lhs, __rhs);
1.149 +}
1.150 +
1.151 +template <class _CharT, class _Traits, class _Alloc, class _Left, class _Right, class _StorageDir>
1.152 +inline _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc,
1.153 + _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir>,
1.154 + _STLP_PRIV __bstr_wrapper<_CharT,_Traits,_Alloc>,
1.155 + _STLP_PRIV __on_left> _STLP_CALL
1.156 +operator+(const _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir>& __lhs,
1.157 + const basic_string<_CharT,_Traits,_Alloc>& __rhs) {
1.158 + return _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir>,
1.159 + _STLP_PRIV __bstr_wrapper<_CharT,_Traits,_Alloc>,
1.160 + _STLP_PRIV __on_left>(__lhs, __rhs);
1.161 +}
1.162 +
1.163 +// addition with C string
1.164 +template <class _CharT, class _Traits, class _Alloc>
1.165 +inline _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc,
1.166 + _STLP_PRIV __bstr_wrapper<_CharT,_Traits,_Alloc>,
1.167 + _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc,
1.168 + _STLP_PRIV __cstr_wrapper<_CharT>,
1.169 + _STLP_PRIV __sum_storage_elem<_CharT, _Traits, _Alloc>,
1.170 + _STLP_PRIV __on_right>,
1.171 + _STLP_PRIV __on_right> _STLP_CALL
1.172 +operator+(const basic_string<_CharT,_Traits,_Alloc>& __x,
1.173 + const _CharT* __s) {
1.174 + const size_t __n = _Traits::length(__s);
1.175 + typedef _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _STLP_PRIV __cstr_wrapper<_CharT>,
1.176 + _STLP_PRIV __sum_storage_elem<_CharT, _Traits, _Alloc>,
1.177 + _STLP_PRIV __on_right> __root_type;
1.178 + __root_type __root(_STLP_PRIV __cstr_wrapper<_CharT>(__s, __n), _STLP_PRIV __sum_storage_elem<_CharT, _Traits, _Alloc>(__x.get_allocator()));
1.179 + return _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _STLP_PRIV __bstr_wrapper<_CharT,_Traits,_Alloc>,
1.180 + __root_type, _STLP_PRIV __on_right>(__x, __root);
1.181 +}
1.182 +
1.183 +template <class _CharT, class _Traits, class _Alloc>
1.184 +inline _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc,
1.185 + _STLP_PRIV __cstr_wrapper<_CharT>,
1.186 + _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc,
1.187 + _STLP_PRIV __bstr_wrapper<_CharT,_Traits,_Alloc>,
1.188 + _STLP_PRIV __sum_storage_elem<_CharT, _Traits, _Alloc>,
1.189 + _STLP_PRIV __on_right>,
1.190 + _STLP_PRIV __on_right> _STLP_CALL
1.191 +operator+(const _CharT* __s,
1.192 + const basic_string<_CharT,_Traits,_Alloc>& __y) {
1.193 + const size_t __n = _Traits::length(__s);
1.194 + typedef _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _STLP_PRIV __bstr_wrapper<_CharT,_Traits,_Alloc>,
1.195 + _STLP_PRIV __sum_storage_elem<_CharT, _Traits, _Alloc>,
1.196 + _STLP_PRIV __on_right> __root_type;
1.197 + __root_type __root(__y, _STLP_PRIV __sum_storage_elem<_CharT, _Traits, _Alloc>(__y.get_allocator()));
1.198 + return _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _STLP_PRIV __cstr_wrapper<_CharT>,
1.199 + __root_type,
1.200 + _STLP_PRIV __on_right>(_STLP_PRIV __cstr_wrapper<_CharT>(__s, __n), __root);
1.201 +}
1.202 +
1.203 +template <class _CharT, class _Traits, class _Alloc, class _Left, class _Right, class _StorageDir>
1.204 +inline _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc,
1.205 + _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir>,
1.206 + _STLP_PRIV __cstr_wrapper<_CharT>,
1.207 + _STLP_PRIV __on_left> _STLP_CALL
1.208 +operator+(const _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir>& __x,
1.209 + const _CharT* __s) {
1.210 + const size_t __n = _Traits::length(__s);
1.211 + return _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir>,
1.212 + _STLP_PRIV __cstr_wrapper<_CharT>,
1.213 + _STLP_PRIV __on_left>(__x, _STLP_PRIV __cstr_wrapper<_CharT>(__s, __n));
1.214 +}
1.215 +
1.216 +template <class _CharT, class _Traits, class _Alloc, class _Left, class _Right, class _StorageDir>
1.217 +inline _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc,
1.218 + _STLP_PRIV __cstr_wrapper<_CharT>,
1.219 + _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir>,
1.220 + _STLP_PRIV __on_right> _STLP_CALL
1.221 +operator+(const _CharT* __s,
1.222 + const _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir>& __y) {
1.223 + const size_t __n = _Traits::length(__s);
1.224 + return _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _STLP_PRIV __cstr_wrapper<_CharT>,
1.225 + _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir>,
1.226 + _STLP_PRIV __on_right>(_STLP_PRIV __cstr_wrapper<_CharT>(__s, __n), __y);
1.227 +}
1.228 +
1.229 +// addition with char
1.230 +template <class _CharT, class _Traits, class _Alloc>
1.231 +inline _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc,
1.232 + _STLP_PRIV __bstr_wrapper<_CharT,_Traits,_Alloc>,
1.233 + _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc,
1.234 + _STLP_PRIV __char_wrapper<_CharT>,
1.235 + _STLP_PRIV __sum_storage_elem<_CharT, _Traits, _Alloc>,
1.236 + _STLP_PRIV __on_right>,
1.237 + _STLP_PRIV __on_right> _STLP_CALL
1.238 +operator+(const basic_string<_CharT,_Traits,_Alloc>& __x, const _CharT __c) {
1.239 + typedef _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _STLP_PRIV __char_wrapper<_CharT>,
1.240 + _STLP_PRIV __sum_storage_elem<_CharT, _Traits, _Alloc>,
1.241 + _STLP_PRIV __on_right> __root_type;
1.242 + __root_type __root(__c, _STLP_PRIV __sum_storage_elem<_CharT, _Traits, _Alloc>(__x.get_allocator()));
1.243 + return _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _STLP_PRIV __bstr_wrapper<_CharT,_Traits,_Alloc>,
1.244 + __root_type, _STLP_PRIV __on_right>(__x, __root);
1.245 +}
1.246 +
1.247 +template <class _CharT, class _Traits, class _Alloc>
1.248 +inline _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc,
1.249 + _STLP_PRIV __char_wrapper<_CharT>,
1.250 + _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc,
1.251 + _STLP_PRIV __bstr_wrapper<_CharT,_Traits,_Alloc>,
1.252 + _STLP_PRIV __sum_storage_elem<_CharT, _Traits, _Alloc>,
1.253 + _STLP_PRIV __on_right>,
1.254 + _STLP_PRIV __on_right> _STLP_CALL
1.255 +operator+(const _CharT __c, const basic_string<_CharT,_Traits,_Alloc>& __x) {
1.256 + typedef _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _STLP_PRIV __bstr_wrapper<_CharT,_Traits,_Alloc>,
1.257 + _STLP_PRIV __sum_storage_elem<_CharT, _Traits, _Alloc>,
1.258 + _STLP_PRIV __on_right> __root_type;
1.259 + __root_type __root(__x, _STLP_PRIV __sum_storage_elem<_CharT, _Traits, _Alloc>(__x.get_allocator()));
1.260 + return _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _STLP_PRIV __char_wrapper<_CharT>,
1.261 + __root_type, _STLP_PRIV __on_right>(__c, __root);
1.262 +}
1.263 +
1.264 +template <class _CharT, class _Traits, class _Alloc, class _Left, class _Right, class _StorageDir>
1.265 +inline _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc,
1.266 + _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir>,
1.267 + _STLP_PRIV __char_wrapper<_CharT>,
1.268 + _STLP_PRIV __on_left> _STLP_CALL
1.269 +operator+(const _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir>& __x, const _CharT __c) {
1.270 + return _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir>,
1.271 + _STLP_PRIV __char_wrapper<_CharT>, _STLP_PRIV __on_left>(__x, __c);
1.272 +}
1.273 +
1.274 +template <class _CharT, class _Traits, class _Alloc, class _Left, class _Right, class _StorageDir>
1.275 +inline _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _STLP_PRIV __char_wrapper<_CharT>,
1.276 + _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir>,
1.277 + _STLP_PRIV __on_right> _STLP_CALL
1.278 +operator+(const _CharT __c, const _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir>& __x) {
1.279 + return _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _STLP_PRIV __char_wrapper<_CharT>,
1.280 + _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir>,
1.281 + _STLP_PRIV __on_right>(__c, __x);
1.282 +}
1.283 +
1.284 +#endif /* _STLP_USE_TEMPLATE_EXPRESSION */
1.285 +
1.286 +// Operator== and operator!=
1.287 +
1.288 +template <class _CharT, class _Traits, class _Alloc>
1.289 +inline bool _STLP_CALL
1.290 +operator==(const basic_string<_CharT,_Traits,_Alloc>& __x,
1.291 + const basic_string<_CharT,_Traits,_Alloc>& __y) {
1.292 + return __x.size() == __y.size() && _Traits::compare(__x.data(), __y.data(), __x.size()) == 0;
1.293 +}
1.294 +
1.295 +#if defined (_STLP_USE_TEMPLATE_EXPRESSION)
1.296 +template <class _CharT, class _Traits, class _Alloc, class _Lhs, class _Rhs, class _StoreDir>
1.297 +inline bool _STLP_CALL
1.298 +operator==(const _STLP_PRIV __bstr_sum<_CharT,_Traits,_Alloc,_Lhs,_Rhs,_StoreDir>& __x,
1.299 + const basic_string<_CharT,_Traits,_Alloc>& __y) {
1.300 + return __x.size() == __y.size() && _Traits::compare(__x.data(), __y.data(), __x.size()) == 0;
1.301 +}
1.302 +
1.303 +template <class _CharT, class _Traits, class _Alloc, class _Lhs, class _Rhs, class _StoreDir>
1.304 +inline bool _STLP_CALL
1.305 +operator==(const basic_string<_CharT,_Traits,_Alloc>& __x,
1.306 + const _STLP_PRIV __bstr_sum<_CharT,_Traits,_Alloc,_Lhs,_Rhs,_StoreDir>& __y) {
1.307 + return __x.size() == __y.size() && _Traits::compare(__x.data(), __y.data(), __x.size()) == 0;
1.308 +}
1.309 +#endif /* _STLP_USE_TEMPLATE_EXPRESSION */
1.310 +
1.311 +
1.312 +template <class _CharT, class _Traits, class _Alloc>
1.313 +inline bool _STLP_CALL
1.314 +operator==(const _CharT* __s,
1.315 + const basic_string<_CharT,_Traits,_Alloc>& __y) {
1.316 + _STLP_FIX_LITERAL_BUG(__s)
1.317 + size_t __n = _Traits::length(__s);
1.318 + return __n == __y.size() && _Traits::compare(__s, __y.data(), __n) == 0;
1.319 +}
1.320 +
1.321 +template <class _CharT, class _Traits, class _Alloc>
1.322 +inline bool _STLP_CALL
1.323 +operator==(const basic_string<_CharT,_Traits,_Alloc>& __x,
1.324 + const _CharT* __s) {
1.325 + _STLP_FIX_LITERAL_BUG(__s)
1.326 + size_t __n = _Traits::length(__s);
1.327 + return __x.size() == __n && _Traits::compare(__x.data(), __s, __n) == 0;
1.328 +}
1.329 +
1.330 +#if defined (_STLP_USE_TEMPLATE_EXPRESSION)
1.331 +template <class _CharT, class _Traits, class _Alloc, class _Lhs, class _Rhs, class _StoreDir>
1.332 +inline bool _STLP_CALL
1.333 +operator==(const _CharT* __s,
1.334 + const _STLP_PRIV __bstr_sum<_CharT,_Traits,_Alloc,_Lhs,_Rhs,_StoreDir>& __y) {
1.335 + _STLP_FIX_LITERAL_BUG(__s)
1.336 + size_t __n = _Traits::length(__s);
1.337 + return __n == __y.size() && _Traits::compare(__s, __y.data(), __n) == 0;
1.338 +}
1.339 +
1.340 +template <class _CharT, class _Traits, class _Alloc, class _Lhs, class _Rhs, class _StoreDir>
1.341 +inline bool _STLP_CALL
1.342 +operator==(const _STLP_PRIV __bstr_sum<_CharT,_Traits,_Alloc,_Lhs,_Rhs,_StoreDir>& __x,
1.343 + const _CharT* __s) {
1.344 + _STLP_FIX_LITERAL_BUG(__s)
1.345 + size_t __n = _Traits::length(__s);
1.346 + return __x.size() == __n && _Traits::compare(__x.data(), __s, __n) == 0;
1.347 +}
1.348 +#endif /* _STLP_USE_TEMPLATE_EXPRESSION */
1.349 +
1.350 +// Operator< (and also >, <=, and >=).
1.351 +
1.352 +template <class _CharT, class _Traits, class _Alloc>
1.353 +inline bool _STLP_CALL
1.354 +operator<(const basic_string<_CharT,_Traits,_Alloc>& __x,
1.355 + const basic_string<_CharT,_Traits,_Alloc>& __y) {
1.356 + return basic_string<_CharT,_Traits,_Alloc> ::_M_compare(__x.begin(), __x.end(),
1.357 + __y.begin(), __y.end()) < 0;
1.358 +}
1.359 +
1.360 +#if defined (_STLP_USE_TEMPLATE_EXPRESSION)
1.361 +template <class _CharT, class _Traits, class _Alloc, class _Lhs, class _Rhs, class _StoreDir>
1.362 +inline bool _STLP_CALL
1.363 +operator<(const _STLP_PRIV __bstr_sum<_CharT,_Traits,_Alloc,_Lhs,_Rhs,_StoreDir>& __x,
1.364 + const basic_string<_CharT,_Traits,_Alloc>& __y) {
1.365 + return basic_string<_CharT,_Traits,_Alloc> ::_M_compare(__x.begin(), __x.end(),
1.366 + __y.begin(), __y.end()) < 0;
1.367 +}
1.368 +
1.369 +template <class _CharT, class _Traits, class _Alloc, class _Lhs, class _Rhs, class _StoreDir>
1.370 +inline bool _STLP_CALL
1.371 +operator<(const basic_string<_CharT,_Traits,_Alloc>& __x,
1.372 + const _STLP_PRIV __bstr_sum<_CharT,_Traits,_Alloc,_Lhs,_Rhs,_StoreDir>& __y) {
1.373 + return basic_string<_CharT,_Traits,_Alloc> ::_M_compare(__x.begin(), __x.end(),
1.374 + __y.begin(), __y.end()) < 0;
1.375 +}
1.376 +#endif /* _STLP_USE_TEMPLATE_EXPRESSION */
1.377 +
1.378 +template <class _CharT, class _Traits, class _Alloc>
1.379 +inline bool _STLP_CALL
1.380 +operator<(const _CharT* __s,
1.381 + const basic_string<_CharT,_Traits,_Alloc>& __y) {
1.382 + _STLP_FIX_LITERAL_BUG(__s)
1.383 + size_t __n = _Traits::length(__s);
1.384 + return basic_string<_CharT,_Traits,_Alloc> ::_M_compare(__s, __s + __n,
1.385 + __y.begin(), __y.end()) < 0;
1.386 +}
1.387 +
1.388 +template <class _CharT, class _Traits, class _Alloc>
1.389 +inline bool _STLP_CALL
1.390 +operator<(const basic_string<_CharT,_Traits,_Alloc>& __x,
1.391 + const _CharT* __s) {
1.392 + _STLP_FIX_LITERAL_BUG(__s)
1.393 + size_t __n = _Traits::length(__s);
1.394 + return basic_string<_CharT,_Traits,_Alloc> ::_M_compare(__x.begin(), __x.end(),
1.395 + __s, __s + __n) < 0;
1.396 +}
1.397 +
1.398 +#if defined (_STLP_USE_TEMPLATE_EXPRESSION)
1.399 +template <class _CharT, class _Traits, class _Alloc, class _Lhs, class _Rhs, class _StoreDir>
1.400 +inline bool _STLP_CALL
1.401 +operator<(const _CharT* __s,
1.402 + const _STLP_PRIV __bstr_sum<_CharT,_Traits,_Alloc,_Lhs,_Rhs,_StoreDir>& __y) {
1.403 + _STLP_FIX_LITERAL_BUG(__s)
1.404 + size_t __n = _Traits::length(__s);
1.405 + return basic_string<_CharT,_Traits,_Alloc> ::_M_compare(__s, __s + __n,
1.406 + __y.begin(), __y.end()) < 0;
1.407 +}
1.408 +
1.409 +template <class _CharT, class _Traits, class _Alloc, class _Lhs, class _Rhs, class _StoreDir>
1.410 +inline bool _STLP_CALL
1.411 +operator<(const _STLP_PRIV __bstr_sum<_CharT,_Traits,_Alloc,_Lhs,_Rhs,_StoreDir>& __x,
1.412 + const _CharT* __s) {
1.413 + _STLP_FIX_LITERAL_BUG(__s)
1.414 + size_t __n = _Traits::length(__s);
1.415 + return basic_string<_CharT,_Traits,_Alloc> ::_M_compare(__x.begin(), __x.end(),
1.416 + __s, __s + __n) < 0;
1.417 +}
1.418 +#endif /* _STLP_USE_TEMPLATE_EXPRESSION */
1.419 +
1.420 +#if defined (_STLP_USE_SEPARATE_RELOPS_NAMESPACE)
1.421 +
1.422 +/* Only defined if _STLP_USE_SEPARATE_RELOPS_NAMESPACE is defined otherwise
1.423 + * it might introduce ambiguity with pure template relational operators
1.424 + * from rel_ops namespace.
1.425 + */
1.426 +template <class _CharT, class _Traits, class _Alloc>
1.427 +inline bool _STLP_CALL
1.428 +operator!=(const basic_string<_CharT,_Traits,_Alloc>& __x,
1.429 + const basic_string<_CharT,_Traits,_Alloc>& __y)
1.430 +{ return !(__x == __y); }
1.431 +
1.432 +template <class _CharT, class _Traits, class _Alloc>
1.433 +inline bool _STLP_CALL
1.434 +operator>(const basic_string<_CharT,_Traits,_Alloc>& __x,
1.435 + const basic_string<_CharT,_Traits,_Alloc>& __y)
1.436 +{ return __y < __x; }
1.437 +
1.438 +template <class _CharT, class _Traits, class _Alloc>
1.439 +inline bool _STLP_CALL
1.440 +operator<=(const basic_string<_CharT,_Traits,_Alloc>& __x,
1.441 + const basic_string<_CharT,_Traits,_Alloc>& __y)
1.442 +{ return !(__y < __x); }
1.443 +
1.444 +template <class _CharT, class _Traits, class _Alloc>
1.445 +inline bool _STLP_CALL
1.446 +operator>=(const basic_string<_CharT,_Traits,_Alloc>& __x,
1.447 + const basic_string<_CharT,_Traits,_Alloc>& __y)
1.448 +{ return !(__x < __y); }
1.449 +
1.450 +# if defined (_STLP_USE_TEMPLATE_EXPRESSION)
1.451 +template <class _CharT, class _Traits, class _Alloc, class _Lhs, class _Rhs, class _StoreDir>
1.452 +inline bool _STLP_CALL
1.453 +operator!=(const _STLP_PRIV __bstr_sum<_CharT,_Traits,_Alloc,_Lhs,_Rhs,_StoreDir>& __x,
1.454 + const basic_string<_CharT,_Traits,_Alloc>& __y)
1.455 +{ return !(__x==__y); }
1.456 +
1.457 +template <class _CharT, class _Traits, class _Alloc, class _Lhs, class _Rhs, class _StoreDir>
1.458 +inline bool _STLP_CALL
1.459 +operator!=(const basic_string<_CharT,_Traits,_Alloc>& __x,
1.460 + const _STLP_PRIV __bstr_sum<_CharT,_Traits,_Alloc,_Lhs,_Rhs,_StoreDir>& __y)
1.461 +{ return !(__x==__y); }
1.462 +# endif
1.463 +
1.464 +#endif /* _STLP_USE_SEPARATE_RELOPS_NAMESPACE */
1.465 +
1.466 +template <class _CharT, class _Traits, class _Alloc>
1.467 +inline bool _STLP_CALL
1.468 +operator!=(const _CharT* __s,
1.469 + const basic_string<_CharT,_Traits,_Alloc>& __y) {
1.470 + _STLP_FIX_LITERAL_BUG(__s)
1.471 + return !(__s == __y);
1.472 +}
1.473 +
1.474 +template <class _CharT, class _Traits, class _Alloc>
1.475 +inline bool _STLP_CALL
1.476 +operator!=(const basic_string<_CharT,_Traits,_Alloc>& __x,
1.477 + const _CharT* __s) {
1.478 + _STLP_FIX_LITERAL_BUG(__s)
1.479 + return !(__x == __s);
1.480 +}
1.481 +
1.482 +#if defined (_STLP_USE_TEMPLATE_EXPRESSION)
1.483 +template <class _CharT, class _Traits, class _Alloc, class _Lhs, class _Rhs, class _StoreDir>
1.484 +inline bool _STLP_CALL
1.485 +operator!=(const _CharT* __s,
1.486 + const _STLP_PRIV __bstr_sum<_CharT,_Traits,_Alloc,_Lhs,_Rhs,_StoreDir>& __y) {
1.487 + _STLP_FIX_LITERAL_BUG(__s)
1.488 + return !(__s == __y);
1.489 +}
1.490 +
1.491 +template <class _CharT, class _Traits, class _Alloc, class _Lhs, class _Rhs, class _StoreDir>
1.492 +inline bool _STLP_CALL
1.493 +operator!=(const _STLP_PRIV __bstr_sum<_CharT,_Traits,_Alloc,_Lhs,_Rhs,_StoreDir>& __x,
1.494 + const _CharT* __s) {
1.495 + _STLP_FIX_LITERAL_BUG(__s)
1.496 + return !(__x == __s);
1.497 +}
1.498 +#endif /* _STLP_USE_TEMPLATE_EXPRESSION */
1.499 +
1.500 +template <class _CharT, class _Traits, class _Alloc>
1.501 +inline bool _STLP_CALL
1.502 +operator>(const _CharT* __s,
1.503 + const basic_string<_CharT,_Traits,_Alloc>& __y) {
1.504 + _STLP_FIX_LITERAL_BUG(__s)
1.505 + return __y < __s;
1.506 +}
1.507 +
1.508 +template <class _CharT, class _Traits, class _Alloc>
1.509 +inline bool _STLP_CALL
1.510 +operator>(const basic_string<_CharT,_Traits,_Alloc>& __x,
1.511 + const _CharT* __s) {
1.512 + _STLP_FIX_LITERAL_BUG(__s)
1.513 + return __s < __x;
1.514 +}
1.515 +
1.516 +#if defined (_STLP_USE_TEMPLATE_EXPRESSION)
1.517 +template <class _CharT, class _Traits, class _Alloc, class _Lhs, class _Rhs, class _StoreDir>
1.518 +inline bool _STLP_CALL
1.519 +operator>(const _CharT* __s,
1.520 + const _STLP_PRIV __bstr_sum<_CharT,_Traits,_Alloc,_Lhs,_Rhs,_StoreDir>& __y) {
1.521 + _STLP_FIX_LITERAL_BUG(__s)
1.522 + return __y < __s;
1.523 +}
1.524 +
1.525 +template <class _CharT, class _Traits, class _Alloc, class _Lhs, class _Rhs, class _StoreDir>
1.526 +inline bool _STLP_CALL
1.527 +operator>(const _STLP_PRIV __bstr_sum<_CharT,_Traits,_Alloc,_Lhs,_Rhs,_StoreDir>& __x,
1.528 + const _CharT* __s) {
1.529 + _STLP_FIX_LITERAL_BUG(__s)
1.530 + return __s < __x;
1.531 +}
1.532 +#endif /* _STLP_USE_TEMPLATE_EXPRESSION */
1.533 +
1.534 +template <class _CharT, class _Traits, class _Alloc>
1.535 +inline bool _STLP_CALL
1.536 +operator<=(const _CharT* __s,
1.537 + const basic_string<_CharT,_Traits,_Alloc>& __y) {
1.538 + _STLP_FIX_LITERAL_BUG(__s)
1.539 + return !(__y < __s);
1.540 +}
1.541 +
1.542 +template <class _CharT, class _Traits, class _Alloc>
1.543 +inline bool _STLP_CALL
1.544 +operator<=(const basic_string<_CharT,_Traits,_Alloc>& __x,
1.545 + const _CharT* __s) {
1.546 + _STLP_FIX_LITERAL_BUG(__s)
1.547 + return !(__s < __x);
1.548 +}
1.549 +
1.550 +#if defined (_STLP_USE_TEMPLATE_EXPRESSION)
1.551 +template <class _CharT, class _Traits, class _Alloc, class _Lhs, class _Rhs, class _StoreDir>
1.552 +inline bool _STLP_CALL
1.553 +operator<=(const _CharT* __s,
1.554 + const _STLP_PRIV __bstr_sum<_CharT,_Traits,_Alloc,_Lhs,_Rhs,_StoreDir>& __y) {
1.555 + _STLP_FIX_LITERAL_BUG(__s)
1.556 + return !(__y < __s);
1.557 +}
1.558 +
1.559 +template <class _CharT, class _Traits, class _Alloc, class _Lhs, class _Rhs, class _StoreDir>
1.560 +inline bool _STLP_CALL
1.561 +operator<=(const _STLP_PRIV __bstr_sum<_CharT,_Traits,_Alloc,_Lhs,_Rhs,_StoreDir>& __x,
1.562 + const _CharT* __s) {
1.563 + _STLP_FIX_LITERAL_BUG(__s)
1.564 + return !(__s < __x);
1.565 +}
1.566 +#endif /* _STLP_USE_TEMPLATE_EXPRESSION */
1.567 +
1.568 +template <class _CharT, class _Traits, class _Alloc>
1.569 +inline bool _STLP_CALL
1.570 +operator>=(const _CharT* __s,
1.571 + const basic_string<_CharT,_Traits,_Alloc>& __y) {
1.572 + _STLP_FIX_LITERAL_BUG(__s)
1.573 + return !(__s < __y);
1.574 +}
1.575 +
1.576 +template <class _CharT, class _Traits, class _Alloc>
1.577 +inline bool _STLP_CALL
1.578 +operator>=(const basic_string<_CharT,_Traits,_Alloc>& __x,
1.579 + const _CharT* __s) {
1.580 + _STLP_FIX_LITERAL_BUG(__s)
1.581 + return !(__x < __s);
1.582 +}
1.583 +
1.584 +#if defined (_STLP_USE_TEMPLATE_EXPRESSION)
1.585 +template <class _CharT, class _Traits, class _Alloc, class _Lhs, class _Rhs, class _StoreDir>
1.586 +inline bool _STLP_CALL
1.587 +operator>=(const _CharT* __s,
1.588 + const _STLP_PRIV __bstr_sum<_CharT,_Traits,_Alloc,_Lhs,_Rhs,_StoreDir>& __y) {
1.589 + _STLP_FIX_LITERAL_BUG(__s)
1.590 + return !(__s < __y);
1.591 +}
1.592 +
1.593 +template <class _CharT, class _Traits, class _Alloc, class _Lhs, class _Rhs, class _StoreDir>
1.594 +inline bool _STLP_CALL
1.595 +operator>=(const _STLP_PRIV __bstr_sum<_CharT,_Traits,_Alloc,_Lhs,_Rhs,_StoreDir>& __x,
1.596 + const _CharT* __s) {
1.597 + _STLP_FIX_LITERAL_BUG(__s)
1.598 + return !(__x < __s);
1.599 +}
1.600 +#endif /* _STLP_USE_TEMPLATE_EXPRESSION */
1.601 +
1.602 +_STLP_END_NAMESPACE
1.603 +
1.604 +#endif /* _STLP_STRING_OPERATORS_H */
1.605 +