5 * This material is provided "as is", with absolutely no warranty expressed
6 * or implied. Any use is at your own risk.
8 * Permission to use or copy this software for any purpose is hereby granted
9 * without fee, provided the above notices are retained on all copies.
10 * Permission to modify the code and to distribute modified code is granted,
11 * provided the above notices are retained, and a notice that the code was
12 * modified is included with the above copyright notice.
16 #ifndef _STLP_STRING_OPERATORS_H
17 #define _STLP_STRING_OPERATORS_H
21 #if !defined (_STLP_USE_TEMPLATE_EXPRESSION)
23 # if defined (__GNUC__) || defined (__MLCCPP__) || (defined (__SYMBIAN32__) && defined (__GCCXML__))
24 # define _STLP_INIT_AMBIGUITY 1
27 template <class _CharT, class _Traits, class _Alloc>
28 inline basic_string<_CharT,_Traits,_Alloc> _STLP_CALL
29 operator+(const basic_string<_CharT,_Traits,_Alloc>& __s,
30 const basic_string<_CharT,_Traits,_Alloc>& __y) {
31 typedef basic_string<_CharT,_Traits,_Alloc> _Str;
32 typedef typename _Str::_Reserve_t _Reserve_t;
33 # if defined (_STLP_INIT_AMBIGUITY)
34 // gcc counts this as a function
35 _Str __result = _Str(_Reserve_t(), __s.size() + __y.size(), __s.get_allocator());
37 _Str __result(_Reserve_t(), __s.size() + __y.size(), __s.get_allocator());
44 template <class _CharT, class _Traits, class _Alloc>
45 inline basic_string<_CharT,_Traits,_Alloc> _STLP_CALL
46 operator+(const _CharT* __s,
47 const basic_string<_CharT,_Traits,_Alloc>& __y) {
48 _STLP_FIX_LITERAL_BUG(__s)
49 typedef basic_string<_CharT,_Traits,_Alloc> _Str;
50 typedef typename _Str::_Reserve_t _Reserve_t;
51 const size_t __n = _Traits::length(__s);
52 # if defined (_STLP_INIT_AMBIGUITY)
53 _Str __result = _Str(_Reserve_t(), __n + __y.size(), __y.get_allocator());
55 _Str __result(_Reserve_t(), __n + __y.size(), __y.get_allocator());
57 __result.append(__s, __s + __n);
62 template <class _CharT, class _Traits, class _Alloc>
63 inline basic_string<_CharT,_Traits,_Alloc> _STLP_CALL
65 const basic_string<_CharT,_Traits,_Alloc>& __y) {
66 typedef basic_string<_CharT,_Traits,_Alloc> _Str;
67 typedef typename _Str::_Reserve_t _Reserve_t;
68 # if defined (_STLP_INIT_AMBIGUITY)
69 _Str __result = _Str(_Reserve_t(), 1 + __y.size(), __y.get_allocator());
71 _Str __result(_Reserve_t(), 1 + __y.size(), __y.get_allocator());
73 __result.push_back(__c);
78 template <class _CharT, class _Traits, class _Alloc>
79 inline basic_string<_CharT,_Traits,_Alloc> _STLP_CALL
80 operator+(const basic_string<_CharT,_Traits,_Alloc>& __x,
82 _STLP_FIX_LITERAL_BUG(__s)
83 typedef basic_string<_CharT,_Traits,_Alloc> _Str;
84 typedef typename _Str::_Reserve_t _Reserve_t;
85 const size_t __n = _Traits::length(__s);
86 # if defined (_STLP_INIT_AMBIGUITY)
87 _Str __result = _Str(_Reserve_t(), __x.size() + __n, __x.get_allocator());
89 _Str __result(_Reserve_t(), __x.size() + __n, __x.get_allocator());
92 __result.append(__s, __s + __n);
96 template <class _CharT, class _Traits, class _Alloc>
97 inline basic_string<_CharT,_Traits,_Alloc> _STLP_CALL
98 operator+(const basic_string<_CharT,_Traits,_Alloc>& __x,
100 typedef basic_string<_CharT,_Traits,_Alloc> _Str;
101 typedef typename _Str::_Reserve_t _Reserve_t;
102 # if defined (_STLP_INIT_AMBIGUITY)
103 _Str __result = _Str(_Reserve_t(), __x.size() + 1, __x.get_allocator());
105 _Str __result(_Reserve_t(), __x.size() + 1, __x.get_allocator());
107 __result.append(__x);
108 __result.push_back(__c);
112 # undef _STLP_INIT_AMBIGUITY
114 #else /* _STLP_USE_TEMPLATE_EXPRESSION */
116 // addition with basic_string
117 template <class _CharT, class _Traits, class _Alloc>
118 inline _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc,
119 _STLP_PRIV __bstr_wrapper<_CharT,_Traits,_Alloc>,
120 _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc,
121 _STLP_PRIV __bstr_wrapper<_CharT,_Traits,_Alloc>,
122 _STLP_PRIV __sum_storage_elem<_CharT, _Traits, _Alloc>,
123 _STLP_PRIV __on_right>,
124 _STLP_PRIV __on_right> _STLP_CALL
125 operator+(const basic_string<_CharT,_Traits,_Alloc>& __lhs,
126 const basic_string<_CharT,_Traits,_Alloc>& __rhs) {
127 typedef _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _STLP_PRIV __bstr_wrapper<_CharT,_Traits,_Alloc>,
128 _STLP_PRIV __sum_storage_elem<_CharT, _Traits, _Alloc>,
129 _STLP_PRIV __on_right> __root_type;
130 __root_type __root(__rhs, _STLP_PRIV __sum_storage_elem<_CharT, _Traits, _Alloc>(__lhs.get_allocator()));
131 return _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _STLP_PRIV __bstr_wrapper<_CharT,_Traits,_Alloc>,
133 _STLP_PRIV __on_right>(__lhs, __root);
136 template <class _CharT, class _Traits, class _Alloc, class _Left, class _Right, class _StorageDir>
137 inline _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc,
138 _STLP_PRIV __bstr_wrapper<_CharT,_Traits,_Alloc>,
139 _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir>,
140 _STLP_PRIV __on_right> _STLP_CALL
141 operator+(const basic_string<_CharT,_Traits,_Alloc>& __lhs,
142 const _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir>& __rhs) {
143 return _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _STLP_PRIV __bstr_wrapper<_CharT,_Traits,_Alloc>,
144 _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir>,
145 _STLP_PRIV __on_right>(__lhs, __rhs);
148 template <class _CharT, class _Traits, class _Alloc, class _Left, class _Right, class _StorageDir>
149 inline _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc,
150 _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir>,
151 _STLP_PRIV __bstr_wrapper<_CharT,_Traits,_Alloc>,
152 _STLP_PRIV __on_left> _STLP_CALL
153 operator+(const _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir>& __lhs,
154 const basic_string<_CharT,_Traits,_Alloc>& __rhs) {
155 return _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir>,
156 _STLP_PRIV __bstr_wrapper<_CharT,_Traits,_Alloc>,
157 _STLP_PRIV __on_left>(__lhs, __rhs);
160 // addition with C string
161 template <class _CharT, class _Traits, class _Alloc>
162 inline _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc,
163 _STLP_PRIV __bstr_wrapper<_CharT,_Traits,_Alloc>,
164 _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc,
165 _STLP_PRIV __cstr_wrapper<_CharT>,
166 _STLP_PRIV __sum_storage_elem<_CharT, _Traits, _Alloc>,
167 _STLP_PRIV __on_right>,
168 _STLP_PRIV __on_right> _STLP_CALL
169 operator+(const basic_string<_CharT,_Traits,_Alloc>& __x,
171 const size_t __n = _Traits::length(__s);
172 typedef _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _STLP_PRIV __cstr_wrapper<_CharT>,
173 _STLP_PRIV __sum_storage_elem<_CharT, _Traits, _Alloc>,
174 _STLP_PRIV __on_right> __root_type;
175 __root_type __root(_STLP_PRIV __cstr_wrapper<_CharT>(__s, __n), _STLP_PRIV __sum_storage_elem<_CharT, _Traits, _Alloc>(__x.get_allocator()));
176 return _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _STLP_PRIV __bstr_wrapper<_CharT,_Traits,_Alloc>,
177 __root_type, _STLP_PRIV __on_right>(__x, __root);
180 template <class _CharT, class _Traits, class _Alloc>
181 inline _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc,
182 _STLP_PRIV __cstr_wrapper<_CharT>,
183 _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc,
184 _STLP_PRIV __bstr_wrapper<_CharT,_Traits,_Alloc>,
185 _STLP_PRIV __sum_storage_elem<_CharT, _Traits, _Alloc>,
186 _STLP_PRIV __on_right>,
187 _STLP_PRIV __on_right> _STLP_CALL
188 operator+(const _CharT* __s,
189 const basic_string<_CharT,_Traits,_Alloc>& __y) {
190 const size_t __n = _Traits::length(__s);
191 typedef _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _STLP_PRIV __bstr_wrapper<_CharT,_Traits,_Alloc>,
192 _STLP_PRIV __sum_storage_elem<_CharT, _Traits, _Alloc>,
193 _STLP_PRIV __on_right> __root_type;
194 __root_type __root(__y, _STLP_PRIV __sum_storage_elem<_CharT, _Traits, _Alloc>(__y.get_allocator()));
195 return _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _STLP_PRIV __cstr_wrapper<_CharT>,
197 _STLP_PRIV __on_right>(_STLP_PRIV __cstr_wrapper<_CharT>(__s, __n), __root);
200 template <class _CharT, class _Traits, class _Alloc, class _Left, class _Right, class _StorageDir>
201 inline _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc,
202 _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir>,
203 _STLP_PRIV __cstr_wrapper<_CharT>,
204 _STLP_PRIV __on_left> _STLP_CALL
205 operator+(const _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir>& __x,
207 const size_t __n = _Traits::length(__s);
208 return _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir>,
209 _STLP_PRIV __cstr_wrapper<_CharT>,
210 _STLP_PRIV __on_left>(__x, _STLP_PRIV __cstr_wrapper<_CharT>(__s, __n));
213 template <class _CharT, class _Traits, class _Alloc, class _Left, class _Right, class _StorageDir>
214 inline _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc,
215 _STLP_PRIV __cstr_wrapper<_CharT>,
216 _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir>,
217 _STLP_PRIV __on_right> _STLP_CALL
218 operator+(const _CharT* __s,
219 const _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir>& __y) {
220 const size_t __n = _Traits::length(__s);
221 return _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _STLP_PRIV __cstr_wrapper<_CharT>,
222 _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir>,
223 _STLP_PRIV __on_right>(_STLP_PRIV __cstr_wrapper<_CharT>(__s, __n), __y);
226 // addition with char
227 template <class _CharT, class _Traits, class _Alloc>
228 inline _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc,
229 _STLP_PRIV __bstr_wrapper<_CharT,_Traits,_Alloc>,
230 _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc,
231 _STLP_PRIV __char_wrapper<_CharT>,
232 _STLP_PRIV __sum_storage_elem<_CharT, _Traits, _Alloc>,
233 _STLP_PRIV __on_right>,
234 _STLP_PRIV __on_right> _STLP_CALL
235 operator+(const basic_string<_CharT,_Traits,_Alloc>& __x, const _CharT __c) {
236 typedef _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _STLP_PRIV __char_wrapper<_CharT>,
237 _STLP_PRIV __sum_storage_elem<_CharT, _Traits, _Alloc>,
238 _STLP_PRIV __on_right> __root_type;
239 __root_type __root(__c, _STLP_PRIV __sum_storage_elem<_CharT, _Traits, _Alloc>(__x.get_allocator()));
240 return _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _STLP_PRIV __bstr_wrapper<_CharT,_Traits,_Alloc>,
241 __root_type, _STLP_PRIV __on_right>(__x, __root);
244 template <class _CharT, class _Traits, class _Alloc>
245 inline _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc,
246 _STLP_PRIV __char_wrapper<_CharT>,
247 _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc,
248 _STLP_PRIV __bstr_wrapper<_CharT,_Traits,_Alloc>,
249 _STLP_PRIV __sum_storage_elem<_CharT, _Traits, _Alloc>,
250 _STLP_PRIV __on_right>,
251 _STLP_PRIV __on_right> _STLP_CALL
252 operator+(const _CharT __c, const basic_string<_CharT,_Traits,_Alloc>& __x) {
253 typedef _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _STLP_PRIV __bstr_wrapper<_CharT,_Traits,_Alloc>,
254 _STLP_PRIV __sum_storage_elem<_CharT, _Traits, _Alloc>,
255 _STLP_PRIV __on_right> __root_type;
256 __root_type __root(__x, _STLP_PRIV __sum_storage_elem<_CharT, _Traits, _Alloc>(__x.get_allocator()));
257 return _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _STLP_PRIV __char_wrapper<_CharT>,
258 __root_type, _STLP_PRIV __on_right>(__c, __root);
261 template <class _CharT, class _Traits, class _Alloc, class _Left, class _Right, class _StorageDir>
262 inline _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc,
263 _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir>,
264 _STLP_PRIV __char_wrapper<_CharT>,
265 _STLP_PRIV __on_left> _STLP_CALL
266 operator+(const _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir>& __x, const _CharT __c) {
267 return _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir>,
268 _STLP_PRIV __char_wrapper<_CharT>, _STLP_PRIV __on_left>(__x, __c);
271 template <class _CharT, class _Traits, class _Alloc, class _Left, class _Right, class _StorageDir>
272 inline _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _STLP_PRIV __char_wrapper<_CharT>,
273 _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir>,
274 _STLP_PRIV __on_right> _STLP_CALL
275 operator+(const _CharT __c, const _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir>& __x) {
276 return _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _STLP_PRIV __char_wrapper<_CharT>,
277 _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir>,
278 _STLP_PRIV __on_right>(__c, __x);
281 #endif /* _STLP_USE_TEMPLATE_EXPRESSION */
283 // Operator== and operator!=
285 template <class _CharT, class _Traits, class _Alloc>
286 inline bool _STLP_CALL
287 operator==(const basic_string<_CharT,_Traits,_Alloc>& __x,
288 const basic_string<_CharT,_Traits,_Alloc>& __y) {
289 return __x.size() == __y.size() && _Traits::compare(__x.data(), __y.data(), __x.size()) == 0;
292 #if defined (_STLP_USE_TEMPLATE_EXPRESSION)
293 template <class _CharT, class _Traits, class _Alloc, class _Lhs, class _Rhs, class _StoreDir>
294 inline bool _STLP_CALL
295 operator==(const _STLP_PRIV __bstr_sum<_CharT,_Traits,_Alloc,_Lhs,_Rhs,_StoreDir>& __x,
296 const basic_string<_CharT,_Traits,_Alloc>& __y) {
297 return __x.size() == __y.size() && _Traits::compare(__x.data(), __y.data(), __x.size()) == 0;
300 template <class _CharT, class _Traits, class _Alloc, class _Lhs, class _Rhs, class _StoreDir>
301 inline bool _STLP_CALL
302 operator==(const basic_string<_CharT,_Traits,_Alloc>& __x,
303 const _STLP_PRIV __bstr_sum<_CharT,_Traits,_Alloc,_Lhs,_Rhs,_StoreDir>& __y) {
304 return __x.size() == __y.size() && _Traits::compare(__x.data(), __y.data(), __x.size()) == 0;
306 #endif /* _STLP_USE_TEMPLATE_EXPRESSION */
309 template <class _CharT, class _Traits, class _Alloc>
310 inline bool _STLP_CALL
311 operator==(const _CharT* __s,
312 const basic_string<_CharT,_Traits,_Alloc>& __y) {
313 _STLP_FIX_LITERAL_BUG(__s)
314 size_t __n = _Traits::length(__s);
315 return __n == __y.size() && _Traits::compare(__s, __y.data(), __n) == 0;
318 template <class _CharT, class _Traits, class _Alloc>
319 inline bool _STLP_CALL
320 operator==(const basic_string<_CharT,_Traits,_Alloc>& __x,
322 _STLP_FIX_LITERAL_BUG(__s)
323 size_t __n = _Traits::length(__s);
324 return __x.size() == __n && _Traits::compare(__x.data(), __s, __n) == 0;
327 #if defined (_STLP_USE_TEMPLATE_EXPRESSION)
328 template <class _CharT, class _Traits, class _Alloc, class _Lhs, class _Rhs, class _StoreDir>
329 inline bool _STLP_CALL
330 operator==(const _CharT* __s,
331 const _STLP_PRIV __bstr_sum<_CharT,_Traits,_Alloc,_Lhs,_Rhs,_StoreDir>& __y) {
332 _STLP_FIX_LITERAL_BUG(__s)
333 size_t __n = _Traits::length(__s);
334 return __n == __y.size() && _Traits::compare(__s, __y.data(), __n) == 0;
337 template <class _CharT, class _Traits, class _Alloc, class _Lhs, class _Rhs, class _StoreDir>
338 inline bool _STLP_CALL
339 operator==(const _STLP_PRIV __bstr_sum<_CharT,_Traits,_Alloc,_Lhs,_Rhs,_StoreDir>& __x,
341 _STLP_FIX_LITERAL_BUG(__s)
342 size_t __n = _Traits::length(__s);
343 return __x.size() == __n && _Traits::compare(__x.data(), __s, __n) == 0;
345 #endif /* _STLP_USE_TEMPLATE_EXPRESSION */
347 // Operator< (and also >, <=, and >=).
349 template <class _CharT, class _Traits, class _Alloc>
350 inline bool _STLP_CALL
351 operator<(const basic_string<_CharT,_Traits,_Alloc>& __x,
352 const basic_string<_CharT,_Traits,_Alloc>& __y) {
353 return basic_string<_CharT,_Traits,_Alloc> ::_M_compare(__x.begin(), __x.end(),
354 __y.begin(), __y.end()) < 0;
357 #if defined (_STLP_USE_TEMPLATE_EXPRESSION)
358 template <class _CharT, class _Traits, class _Alloc, class _Lhs, class _Rhs, class _StoreDir>
359 inline bool _STLP_CALL
360 operator<(const _STLP_PRIV __bstr_sum<_CharT,_Traits,_Alloc,_Lhs,_Rhs,_StoreDir>& __x,
361 const basic_string<_CharT,_Traits,_Alloc>& __y) {
362 return basic_string<_CharT,_Traits,_Alloc> ::_M_compare(__x.begin(), __x.end(),
363 __y.begin(), __y.end()) < 0;
366 template <class _CharT, class _Traits, class _Alloc, class _Lhs, class _Rhs, class _StoreDir>
367 inline bool _STLP_CALL
368 operator<(const basic_string<_CharT,_Traits,_Alloc>& __x,
369 const _STLP_PRIV __bstr_sum<_CharT,_Traits,_Alloc,_Lhs,_Rhs,_StoreDir>& __y) {
370 return basic_string<_CharT,_Traits,_Alloc> ::_M_compare(__x.begin(), __x.end(),
371 __y.begin(), __y.end()) < 0;
373 #endif /* _STLP_USE_TEMPLATE_EXPRESSION */
375 template <class _CharT, class _Traits, class _Alloc>
376 inline bool _STLP_CALL
377 operator<(const _CharT* __s,
378 const basic_string<_CharT,_Traits,_Alloc>& __y) {
379 _STLP_FIX_LITERAL_BUG(__s)
380 size_t __n = _Traits::length(__s);
381 return basic_string<_CharT,_Traits,_Alloc> ::_M_compare(__s, __s + __n,
382 __y.begin(), __y.end()) < 0;
385 template <class _CharT, class _Traits, class _Alloc>
386 inline bool _STLP_CALL
387 operator<(const basic_string<_CharT,_Traits,_Alloc>& __x,
389 _STLP_FIX_LITERAL_BUG(__s)
390 size_t __n = _Traits::length(__s);
391 return basic_string<_CharT,_Traits,_Alloc> ::_M_compare(__x.begin(), __x.end(),
395 #if defined (_STLP_USE_TEMPLATE_EXPRESSION)
396 template <class _CharT, class _Traits, class _Alloc, class _Lhs, class _Rhs, class _StoreDir>
397 inline bool _STLP_CALL
398 operator<(const _CharT* __s,
399 const _STLP_PRIV __bstr_sum<_CharT,_Traits,_Alloc,_Lhs,_Rhs,_StoreDir>& __y) {
400 _STLP_FIX_LITERAL_BUG(__s)
401 size_t __n = _Traits::length(__s);
402 return basic_string<_CharT,_Traits,_Alloc> ::_M_compare(__s, __s + __n,
403 __y.begin(), __y.end()) < 0;
406 template <class _CharT, class _Traits, class _Alloc, class _Lhs, class _Rhs, class _StoreDir>
407 inline bool _STLP_CALL
408 operator<(const _STLP_PRIV __bstr_sum<_CharT,_Traits,_Alloc,_Lhs,_Rhs,_StoreDir>& __x,
410 _STLP_FIX_LITERAL_BUG(__s)
411 size_t __n = _Traits::length(__s);
412 return basic_string<_CharT,_Traits,_Alloc> ::_M_compare(__x.begin(), __x.end(),
415 #endif /* _STLP_USE_TEMPLATE_EXPRESSION */
417 #if defined (_STLP_USE_SEPARATE_RELOPS_NAMESPACE)
419 /* Only defined if _STLP_USE_SEPARATE_RELOPS_NAMESPACE is defined otherwise
420 * it might introduce ambiguity with pure template relational operators
421 * from rel_ops namespace.
423 template <class _CharT, class _Traits, class _Alloc>
424 inline bool _STLP_CALL
425 operator!=(const basic_string<_CharT,_Traits,_Alloc>& __x,
426 const basic_string<_CharT,_Traits,_Alloc>& __y)
427 { return !(__x == __y); }
429 template <class _CharT, class _Traits, class _Alloc>
430 inline bool _STLP_CALL
431 operator>(const basic_string<_CharT,_Traits,_Alloc>& __x,
432 const basic_string<_CharT,_Traits,_Alloc>& __y)
433 { return __y < __x; }
435 template <class _CharT, class _Traits, class _Alloc>
436 inline bool _STLP_CALL
437 operator<=(const basic_string<_CharT,_Traits,_Alloc>& __x,
438 const basic_string<_CharT,_Traits,_Alloc>& __y)
439 { return !(__y < __x); }
441 template <class _CharT, class _Traits, class _Alloc>
442 inline bool _STLP_CALL
443 operator>=(const basic_string<_CharT,_Traits,_Alloc>& __x,
444 const basic_string<_CharT,_Traits,_Alloc>& __y)
445 { return !(__x < __y); }
447 # if defined (_STLP_USE_TEMPLATE_EXPRESSION)
448 template <class _CharT, class _Traits, class _Alloc, class _Lhs, class _Rhs, class _StoreDir>
449 inline bool _STLP_CALL
450 operator!=(const _STLP_PRIV __bstr_sum<_CharT,_Traits,_Alloc,_Lhs,_Rhs,_StoreDir>& __x,
451 const basic_string<_CharT,_Traits,_Alloc>& __y)
452 { return !(__x==__y); }
454 template <class _CharT, class _Traits, class _Alloc, class _Lhs, class _Rhs, class _StoreDir>
455 inline bool _STLP_CALL
456 operator!=(const basic_string<_CharT,_Traits,_Alloc>& __x,
457 const _STLP_PRIV __bstr_sum<_CharT,_Traits,_Alloc,_Lhs,_Rhs,_StoreDir>& __y)
458 { return !(__x==__y); }
461 #endif /* _STLP_USE_SEPARATE_RELOPS_NAMESPACE */
463 template <class _CharT, class _Traits, class _Alloc>
464 inline bool _STLP_CALL
465 operator!=(const _CharT* __s,
466 const basic_string<_CharT,_Traits,_Alloc>& __y) {
467 _STLP_FIX_LITERAL_BUG(__s)
468 return !(__s == __y);
471 template <class _CharT, class _Traits, class _Alloc>
472 inline bool _STLP_CALL
473 operator!=(const basic_string<_CharT,_Traits,_Alloc>& __x,
475 _STLP_FIX_LITERAL_BUG(__s)
476 return !(__x == __s);
479 #if defined (_STLP_USE_TEMPLATE_EXPRESSION)
480 template <class _CharT, class _Traits, class _Alloc, class _Lhs, class _Rhs, class _StoreDir>
481 inline bool _STLP_CALL
482 operator!=(const _CharT* __s,
483 const _STLP_PRIV __bstr_sum<_CharT,_Traits,_Alloc,_Lhs,_Rhs,_StoreDir>& __y) {
484 _STLP_FIX_LITERAL_BUG(__s)
485 return !(__s == __y);
488 template <class _CharT, class _Traits, class _Alloc, class _Lhs, class _Rhs, class _StoreDir>
489 inline bool _STLP_CALL
490 operator!=(const _STLP_PRIV __bstr_sum<_CharT,_Traits,_Alloc,_Lhs,_Rhs,_StoreDir>& __x,
492 _STLP_FIX_LITERAL_BUG(__s)
493 return !(__x == __s);
495 #endif /* _STLP_USE_TEMPLATE_EXPRESSION */
497 template <class _CharT, class _Traits, class _Alloc>
498 inline bool _STLP_CALL
499 operator>(const _CharT* __s,
500 const basic_string<_CharT,_Traits,_Alloc>& __y) {
501 _STLP_FIX_LITERAL_BUG(__s)
505 template <class _CharT, class _Traits, class _Alloc>
506 inline bool _STLP_CALL
507 operator>(const basic_string<_CharT,_Traits,_Alloc>& __x,
509 _STLP_FIX_LITERAL_BUG(__s)
513 #if defined (_STLP_USE_TEMPLATE_EXPRESSION)
514 template <class _CharT, class _Traits, class _Alloc, class _Lhs, class _Rhs, class _StoreDir>
515 inline bool _STLP_CALL
516 operator>(const _CharT* __s,
517 const _STLP_PRIV __bstr_sum<_CharT,_Traits,_Alloc,_Lhs,_Rhs,_StoreDir>& __y) {
518 _STLP_FIX_LITERAL_BUG(__s)
522 template <class _CharT, class _Traits, class _Alloc, class _Lhs, class _Rhs, class _StoreDir>
523 inline bool _STLP_CALL
524 operator>(const _STLP_PRIV __bstr_sum<_CharT,_Traits,_Alloc,_Lhs,_Rhs,_StoreDir>& __x,
526 _STLP_FIX_LITERAL_BUG(__s)
529 #endif /* _STLP_USE_TEMPLATE_EXPRESSION */
531 template <class _CharT, class _Traits, class _Alloc>
532 inline bool _STLP_CALL
533 operator<=(const _CharT* __s,
534 const basic_string<_CharT,_Traits,_Alloc>& __y) {
535 _STLP_FIX_LITERAL_BUG(__s)
539 template <class _CharT, class _Traits, class _Alloc>
540 inline bool _STLP_CALL
541 operator<=(const basic_string<_CharT,_Traits,_Alloc>& __x,
543 _STLP_FIX_LITERAL_BUG(__s)
547 #if defined (_STLP_USE_TEMPLATE_EXPRESSION)
548 template <class _CharT, class _Traits, class _Alloc, class _Lhs, class _Rhs, class _StoreDir>
549 inline bool _STLP_CALL
550 operator<=(const _CharT* __s,
551 const _STLP_PRIV __bstr_sum<_CharT,_Traits,_Alloc,_Lhs,_Rhs,_StoreDir>& __y) {
552 _STLP_FIX_LITERAL_BUG(__s)
556 template <class _CharT, class _Traits, class _Alloc, class _Lhs, class _Rhs, class _StoreDir>
557 inline bool _STLP_CALL
558 operator<=(const _STLP_PRIV __bstr_sum<_CharT,_Traits,_Alloc,_Lhs,_Rhs,_StoreDir>& __x,
560 _STLP_FIX_LITERAL_BUG(__s)
563 #endif /* _STLP_USE_TEMPLATE_EXPRESSION */
565 template <class _CharT, class _Traits, class _Alloc>
566 inline bool _STLP_CALL
567 operator>=(const _CharT* __s,
568 const basic_string<_CharT,_Traits,_Alloc>& __y) {
569 _STLP_FIX_LITERAL_BUG(__s)
573 template <class _CharT, class _Traits, class _Alloc>
574 inline bool _STLP_CALL
575 operator>=(const basic_string<_CharT,_Traits,_Alloc>& __x,
577 _STLP_FIX_LITERAL_BUG(__s)
581 #if defined (_STLP_USE_TEMPLATE_EXPRESSION)
582 template <class _CharT, class _Traits, class _Alloc, class _Lhs, class _Rhs, class _StoreDir>
583 inline bool _STLP_CALL
584 operator>=(const _CharT* __s,
585 const _STLP_PRIV __bstr_sum<_CharT,_Traits,_Alloc,_Lhs,_Rhs,_StoreDir>& __y) {
586 _STLP_FIX_LITERAL_BUG(__s)
590 template <class _CharT, class _Traits, class _Alloc, class _Lhs, class _Rhs, class _StoreDir>
591 inline bool _STLP_CALL
592 operator>=(const _STLP_PRIV __bstr_sum<_CharT,_Traits,_Alloc,_Lhs,_Rhs,_StoreDir>& __x,
594 _STLP_FIX_LITERAL_BUG(__s)
597 #endif /* _STLP_USE_TEMPLATE_EXPRESSION */
601 #endif /* _STLP_STRING_OPERATORS_H */