williamr@2: /* williamr@2: * Copyright (c) 2003 williamr@2: * Francois Dumont williamr@2: * williamr@2: * This material is provided "as is", with absolutely no warranty expressed williamr@2: * or implied. Any use is at your own risk. williamr@2: * williamr@2: * Permission to use or copy this software for any purpose is hereby granted williamr@2: * without fee, provided the above notices are retained on all copies. williamr@2: * Permission to modify the code and to distribute modified code is granted, williamr@2: * provided the above notices are retained, and a notice that the code was williamr@2: * modified is included with the above copyright notice. williamr@2: * williamr@2: */ williamr@2: williamr@2: #ifndef _STLP_STRING_OPERATORS_H williamr@2: #define _STLP_STRING_OPERATORS_H williamr@2: williamr@2: _STLP_BEGIN_NAMESPACE williamr@2: williamr@2: #if !defined (_STLP_USE_TEMPLATE_EXPRESSION) williamr@2: williamr@2: # if defined (__GNUC__) || defined (__MLCCPP__) williamr@2: # define _STLP_INIT_AMBIGUITY 1 williamr@2: # endif williamr@2: williamr@2: template williamr@2: inline basic_string<_CharT,_Traits,_Alloc> _STLP_CALL williamr@2: operator+(const basic_string<_CharT,_Traits,_Alloc>& __s, williamr@2: const basic_string<_CharT,_Traits,_Alloc>& __y) { williamr@2: typedef basic_string<_CharT,_Traits,_Alloc> _Str; williamr@2: typedef typename _Str::_Reserve_t _Reserve_t; williamr@2: # if defined (_STLP_INIT_AMBIGUITY) williamr@2: // gcc counts this as a function williamr@2: _Str __result = _Str(_Reserve_t(), __s.size() + __y.size(), __s.get_allocator()); williamr@2: # else williamr@2: _Str __result(_Reserve_t(), __s.size() + __y.size(), __s.get_allocator()); williamr@2: # endif williamr@2: __result.append(__s); williamr@2: __result.append(__y); williamr@2: return __result; williamr@2: } williamr@2: williamr@2: template williamr@2: inline basic_string<_CharT,_Traits,_Alloc> _STLP_CALL williamr@2: operator+(const _CharT* __s, williamr@2: const basic_string<_CharT,_Traits,_Alloc>& __y) { williamr@2: _STLP_FIX_LITERAL_BUG(__s) williamr@2: typedef basic_string<_CharT,_Traits,_Alloc> _Str; williamr@2: typedef typename _Str::_Reserve_t _Reserve_t; williamr@2: const size_t __n = _Traits::length(__s); williamr@2: # if defined (_STLP_INIT_AMBIGUITY) williamr@2: _Str __result = _Str(_Reserve_t(), __n + __y.size(), __y.get_allocator()); williamr@2: # else williamr@2: _Str __result(_Reserve_t(), __n + __y.size(), __y.get_allocator()); williamr@2: # endif williamr@2: __result.append(__s, __s + __n); williamr@2: __result.append(__y); williamr@2: return __result; williamr@2: } williamr@2: williamr@2: template williamr@2: inline basic_string<_CharT,_Traits,_Alloc> _STLP_CALL williamr@2: operator+(_CharT __c, williamr@2: const basic_string<_CharT,_Traits,_Alloc>& __y) { williamr@2: typedef basic_string<_CharT,_Traits,_Alloc> _Str; williamr@2: typedef typename _Str::_Reserve_t _Reserve_t; williamr@2: # if defined (_STLP_INIT_AMBIGUITY) williamr@2: _Str __result = _Str(_Reserve_t(), 1 + __y.size(), __y.get_allocator()); williamr@2: # else williamr@2: _Str __result(_Reserve_t(), 1 + __y.size(), __y.get_allocator()); williamr@2: # endif williamr@2: __result.push_back(__c); williamr@2: __result.append(__y); williamr@2: return __result; williamr@2: } williamr@2: williamr@2: template williamr@2: inline basic_string<_CharT,_Traits,_Alloc> _STLP_CALL williamr@2: operator+(const basic_string<_CharT,_Traits,_Alloc>& __x, williamr@2: const _CharT* __s) { williamr@2: _STLP_FIX_LITERAL_BUG(__s) williamr@2: typedef basic_string<_CharT,_Traits,_Alloc> _Str; williamr@2: typedef typename _Str::_Reserve_t _Reserve_t; williamr@2: const size_t __n = _Traits::length(__s); williamr@2: # if defined (_STLP_INIT_AMBIGUITY) williamr@2: _Str __result = _Str(_Reserve_t(), __x.size() + __n, __x.get_allocator()); williamr@2: # else williamr@2: _Str __result(_Reserve_t(), __x.size() + __n, __x.get_allocator()); williamr@2: # endif williamr@2: __result.append(__x); williamr@2: __result.append(__s, __s + __n); williamr@2: return __result; williamr@2: } williamr@2: williamr@2: template williamr@2: inline basic_string<_CharT,_Traits,_Alloc> _STLP_CALL williamr@2: operator+(const basic_string<_CharT,_Traits,_Alloc>& __x, williamr@2: const _CharT __c) { williamr@2: typedef basic_string<_CharT,_Traits,_Alloc> _Str; williamr@2: typedef typename _Str::_Reserve_t _Reserve_t; williamr@2: # if defined (_STLP_INIT_AMBIGUITY) williamr@2: _Str __result = _Str(_Reserve_t(), __x.size() + 1, __x.get_allocator()); williamr@2: # else williamr@2: _Str __result(_Reserve_t(), __x.size() + 1, __x.get_allocator()); williamr@2: # endif williamr@2: __result.append(__x); williamr@2: __result.push_back(__c); williamr@2: return __result; williamr@2: } williamr@2: williamr@2: # undef _STLP_INIT_AMBIGUITY williamr@2: williamr@2: #else /* _STLP_USE_TEMPLATE_EXPRESSION */ williamr@2: williamr@2: // addition with basic_string williamr@2: template williamr@2: inline _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, williamr@2: _STLP_PRIV __bstr_wrapper<_CharT,_Traits,_Alloc>, williamr@2: _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, williamr@2: _STLP_PRIV __bstr_wrapper<_CharT,_Traits,_Alloc>, williamr@2: _STLP_PRIV __sum_storage_elem<_CharT, _Traits, _Alloc>, williamr@2: _STLP_PRIV __on_right>, williamr@2: _STLP_PRIV __on_right> _STLP_CALL williamr@2: operator+(const basic_string<_CharT,_Traits,_Alloc>& __lhs, williamr@2: const basic_string<_CharT,_Traits,_Alloc>& __rhs) { williamr@2: typedef _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _STLP_PRIV __bstr_wrapper<_CharT,_Traits,_Alloc>, williamr@2: _STLP_PRIV __sum_storage_elem<_CharT, _Traits, _Alloc>, williamr@2: _STLP_PRIV __on_right> __root_type; williamr@2: __root_type __root(__rhs, _STLP_PRIV __sum_storage_elem<_CharT, _Traits, _Alloc>(__lhs.get_allocator())); williamr@2: return _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _STLP_PRIV __bstr_wrapper<_CharT,_Traits,_Alloc>, williamr@2: __root_type, williamr@2: _STLP_PRIV __on_right>(__lhs, __root); williamr@2: } williamr@2: williamr@2: template williamr@2: inline _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, williamr@2: _STLP_PRIV __bstr_wrapper<_CharT,_Traits,_Alloc>, williamr@2: _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir>, williamr@2: _STLP_PRIV __on_right> _STLP_CALL williamr@2: operator+(const basic_string<_CharT,_Traits,_Alloc>& __lhs, williamr@2: const _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir>& __rhs) { williamr@2: return _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _STLP_PRIV __bstr_wrapper<_CharT,_Traits,_Alloc>, williamr@2: _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir>, williamr@2: _STLP_PRIV __on_right>(__lhs, __rhs); williamr@2: } williamr@2: williamr@2: template williamr@2: inline _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, williamr@2: _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir>, williamr@2: _STLP_PRIV __bstr_wrapper<_CharT,_Traits,_Alloc>, williamr@2: _STLP_PRIV __on_left> _STLP_CALL williamr@2: operator+(const _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir>& __lhs, williamr@2: const basic_string<_CharT,_Traits,_Alloc>& __rhs) { williamr@2: return _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir>, williamr@2: _STLP_PRIV __bstr_wrapper<_CharT,_Traits,_Alloc>, williamr@2: _STLP_PRIV __on_left>(__lhs, __rhs); williamr@2: } williamr@2: williamr@2: // addition with C string williamr@2: template williamr@2: inline _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, williamr@2: _STLP_PRIV __bstr_wrapper<_CharT,_Traits,_Alloc>, williamr@2: _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, williamr@2: _STLP_PRIV __cstr_wrapper<_CharT>, williamr@2: _STLP_PRIV __sum_storage_elem<_CharT, _Traits, _Alloc>, williamr@2: _STLP_PRIV __on_right>, williamr@2: _STLP_PRIV __on_right> _STLP_CALL williamr@2: operator+(const basic_string<_CharT,_Traits,_Alloc>& __x, williamr@2: const _CharT* __s) { williamr@2: const size_t __n = _Traits::length(__s); williamr@2: typedef _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _STLP_PRIV __cstr_wrapper<_CharT>, williamr@2: _STLP_PRIV __sum_storage_elem<_CharT, _Traits, _Alloc>, williamr@2: _STLP_PRIV __on_right> __root_type; williamr@2: __root_type __root(_STLP_PRIV __cstr_wrapper<_CharT>(__s, __n), _STLP_PRIV __sum_storage_elem<_CharT, _Traits, _Alloc>(__x.get_allocator())); williamr@2: return _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _STLP_PRIV __bstr_wrapper<_CharT,_Traits,_Alloc>, williamr@2: __root_type, _STLP_PRIV __on_right>(__x, __root); williamr@2: } williamr@2: williamr@2: template williamr@2: inline _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, williamr@2: _STLP_PRIV __cstr_wrapper<_CharT>, williamr@2: _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, williamr@2: _STLP_PRIV __bstr_wrapper<_CharT,_Traits,_Alloc>, williamr@2: _STLP_PRIV __sum_storage_elem<_CharT, _Traits, _Alloc>, williamr@2: _STLP_PRIV __on_right>, williamr@2: _STLP_PRIV __on_right> _STLP_CALL williamr@2: operator+(const _CharT* __s, williamr@2: const basic_string<_CharT,_Traits,_Alloc>& __y) { williamr@2: const size_t __n = _Traits::length(__s); williamr@2: typedef _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _STLP_PRIV __bstr_wrapper<_CharT,_Traits,_Alloc>, williamr@2: _STLP_PRIV __sum_storage_elem<_CharT, _Traits, _Alloc>, williamr@2: _STLP_PRIV __on_right> __root_type; williamr@2: __root_type __root(__y, _STLP_PRIV __sum_storage_elem<_CharT, _Traits, _Alloc>(__y.get_allocator())); williamr@2: return _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _STLP_PRIV __cstr_wrapper<_CharT>, williamr@2: __root_type, williamr@2: _STLP_PRIV __on_right>(_STLP_PRIV __cstr_wrapper<_CharT>(__s, __n), __root); williamr@2: } williamr@2: williamr@2: template williamr@2: inline _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, williamr@2: _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir>, williamr@2: _STLP_PRIV __cstr_wrapper<_CharT>, williamr@2: _STLP_PRIV __on_left> _STLP_CALL williamr@2: operator+(const _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir>& __x, williamr@2: const _CharT* __s) { williamr@2: const size_t __n = _Traits::length(__s); williamr@2: return _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir>, williamr@2: _STLP_PRIV __cstr_wrapper<_CharT>, williamr@2: _STLP_PRIV __on_left>(__x, _STLP_PRIV __cstr_wrapper<_CharT>(__s, __n)); williamr@2: } williamr@2: williamr@2: template williamr@2: inline _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, williamr@2: _STLP_PRIV __cstr_wrapper<_CharT>, williamr@2: _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir>, williamr@2: _STLP_PRIV __on_right> _STLP_CALL williamr@2: operator+(const _CharT* __s, williamr@2: const _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir>& __y) { williamr@2: const size_t __n = _Traits::length(__s); williamr@2: return _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _STLP_PRIV __cstr_wrapper<_CharT>, williamr@2: _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir>, williamr@2: _STLP_PRIV __on_right>(_STLP_PRIV __cstr_wrapper<_CharT>(__s, __n), __y); williamr@2: } williamr@2: williamr@2: // addition with char williamr@2: template williamr@2: inline _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, williamr@2: _STLP_PRIV __bstr_wrapper<_CharT,_Traits,_Alloc>, williamr@2: _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, williamr@2: _STLP_PRIV __char_wrapper<_CharT>, williamr@2: _STLP_PRIV __sum_storage_elem<_CharT, _Traits, _Alloc>, williamr@2: _STLP_PRIV __on_right>, williamr@2: _STLP_PRIV __on_right> _STLP_CALL williamr@2: operator+(const basic_string<_CharT,_Traits,_Alloc>& __x, const _CharT __c) { williamr@2: typedef _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _STLP_PRIV __char_wrapper<_CharT>, williamr@2: _STLP_PRIV __sum_storage_elem<_CharT, _Traits, _Alloc>, williamr@2: _STLP_PRIV __on_right> __root_type; williamr@2: __root_type __root(__c, _STLP_PRIV __sum_storage_elem<_CharT, _Traits, _Alloc>(__x.get_allocator())); williamr@2: return _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _STLP_PRIV __bstr_wrapper<_CharT,_Traits,_Alloc>, williamr@2: __root_type, _STLP_PRIV __on_right>(__x, __root); williamr@2: } williamr@2: williamr@2: template williamr@2: inline _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, williamr@2: _STLP_PRIV __char_wrapper<_CharT>, williamr@2: _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, williamr@2: _STLP_PRIV __bstr_wrapper<_CharT,_Traits,_Alloc>, williamr@2: _STLP_PRIV __sum_storage_elem<_CharT, _Traits, _Alloc>, williamr@2: _STLP_PRIV __on_right>, williamr@2: _STLP_PRIV __on_right> _STLP_CALL williamr@2: operator+(const _CharT __c, const basic_string<_CharT,_Traits,_Alloc>& __x) { williamr@2: typedef _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _STLP_PRIV __bstr_wrapper<_CharT,_Traits,_Alloc>, williamr@2: _STLP_PRIV __sum_storage_elem<_CharT, _Traits, _Alloc>, williamr@2: _STLP_PRIV __on_right> __root_type; williamr@2: __root_type __root(__x, _STLP_PRIV __sum_storage_elem<_CharT, _Traits, _Alloc>(__x.get_allocator())); williamr@2: return _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _STLP_PRIV __char_wrapper<_CharT>, williamr@2: __root_type, _STLP_PRIV __on_right>(__c, __root); williamr@2: } williamr@2: williamr@2: template williamr@2: inline _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, williamr@2: _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir>, williamr@2: _STLP_PRIV __char_wrapper<_CharT>, williamr@2: _STLP_PRIV __on_left> _STLP_CALL williamr@2: operator+(const _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir>& __x, const _CharT __c) { williamr@2: return _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir>, williamr@2: _STLP_PRIV __char_wrapper<_CharT>, _STLP_PRIV __on_left>(__x, __c); williamr@2: } williamr@2: williamr@2: template williamr@2: inline _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _STLP_PRIV __char_wrapper<_CharT>, williamr@2: _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir>, williamr@2: _STLP_PRIV __on_right> _STLP_CALL williamr@2: operator+(const _CharT __c, const _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir>& __x) { williamr@2: return _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _STLP_PRIV __char_wrapper<_CharT>, williamr@2: _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir>, williamr@2: _STLP_PRIV __on_right>(__c, __x); williamr@2: } williamr@2: williamr@2: #endif /* _STLP_USE_TEMPLATE_EXPRESSION */ williamr@2: williamr@2: // Operator== and operator!= williamr@2: williamr@2: template williamr@2: inline bool _STLP_CALL williamr@2: operator==(const basic_string<_CharT,_Traits,_Alloc>& __x, williamr@2: const basic_string<_CharT,_Traits,_Alloc>& __y) { williamr@2: return __x.size() == __y.size() && _Traits::compare(__x.data(), __y.data(), __x.size()) == 0; williamr@2: } williamr@2: williamr@2: #if defined (_STLP_USE_TEMPLATE_EXPRESSION) williamr@2: template williamr@2: inline bool _STLP_CALL williamr@2: operator==(const _STLP_PRIV __bstr_sum<_CharT,_Traits,_Alloc,_Lhs,_Rhs,_StoreDir>& __x, williamr@2: const basic_string<_CharT,_Traits,_Alloc>& __y) { williamr@2: return __x.size() == __y.size() && _Traits::compare(__x.data(), __y.data(), __x.size()) == 0; williamr@2: } williamr@2: williamr@2: template williamr@2: inline bool _STLP_CALL williamr@2: operator==(const basic_string<_CharT,_Traits,_Alloc>& __x, williamr@2: const _STLP_PRIV __bstr_sum<_CharT,_Traits,_Alloc,_Lhs,_Rhs,_StoreDir>& __y) { williamr@2: return __x.size() == __y.size() && _Traits::compare(__x.data(), __y.data(), __x.size()) == 0; williamr@2: } williamr@2: #endif /* _STLP_USE_TEMPLATE_EXPRESSION */ williamr@2: williamr@2: williamr@2: template williamr@2: inline bool _STLP_CALL williamr@2: operator==(const _CharT* __s, williamr@2: const basic_string<_CharT,_Traits,_Alloc>& __y) { williamr@2: _STLP_FIX_LITERAL_BUG(__s) williamr@2: size_t __n = _Traits::length(__s); williamr@2: return __n == __y.size() && _Traits::compare(__s, __y.data(), __n) == 0; williamr@2: } williamr@2: williamr@2: template williamr@2: inline bool _STLP_CALL williamr@2: operator==(const basic_string<_CharT,_Traits,_Alloc>& __x, williamr@2: const _CharT* __s) { williamr@2: _STLP_FIX_LITERAL_BUG(__s) williamr@2: size_t __n = _Traits::length(__s); williamr@2: return __x.size() == __n && _Traits::compare(__x.data(), __s, __n) == 0; williamr@2: } williamr@2: williamr@2: #if defined (_STLP_USE_TEMPLATE_EXPRESSION) williamr@2: template williamr@2: inline bool _STLP_CALL williamr@2: operator==(const _CharT* __s, williamr@2: const _STLP_PRIV __bstr_sum<_CharT,_Traits,_Alloc,_Lhs,_Rhs,_StoreDir>& __y) { williamr@2: _STLP_FIX_LITERAL_BUG(__s) williamr@2: size_t __n = _Traits::length(__s); williamr@2: return __n == __y.size() && _Traits::compare(__s, __y.data(), __n) == 0; williamr@2: } williamr@2: williamr@2: template williamr@2: inline bool _STLP_CALL williamr@2: operator==(const _STLP_PRIV __bstr_sum<_CharT,_Traits,_Alloc,_Lhs,_Rhs,_StoreDir>& __x, williamr@2: const _CharT* __s) { williamr@2: _STLP_FIX_LITERAL_BUG(__s) williamr@2: size_t __n = _Traits::length(__s); williamr@2: return __x.size() == __n && _Traits::compare(__x.data(), __s, __n) == 0; williamr@2: } williamr@2: #endif /* _STLP_USE_TEMPLATE_EXPRESSION */ williamr@2: williamr@2: // Operator< (and also >, <=, and >=). williamr@2: williamr@2: template williamr@2: inline bool _STLP_CALL williamr@2: operator<(const basic_string<_CharT,_Traits,_Alloc>& __x, williamr@2: const basic_string<_CharT,_Traits,_Alloc>& __y) { williamr@2: return basic_string<_CharT,_Traits,_Alloc> ::_M_compare(__x.begin(), __x.end(), williamr@2: __y.begin(), __y.end()) < 0; williamr@2: } williamr@2: williamr@2: #if defined (_STLP_USE_TEMPLATE_EXPRESSION) williamr@2: template williamr@2: inline bool _STLP_CALL williamr@2: operator<(const _STLP_PRIV __bstr_sum<_CharT,_Traits,_Alloc,_Lhs,_Rhs,_StoreDir>& __x, williamr@2: const basic_string<_CharT,_Traits,_Alloc>& __y) { williamr@2: return basic_string<_CharT,_Traits,_Alloc> ::_M_compare(__x.begin(), __x.end(), williamr@2: __y.begin(), __y.end()) < 0; williamr@2: } williamr@2: williamr@2: template williamr@2: inline bool _STLP_CALL williamr@2: operator<(const basic_string<_CharT,_Traits,_Alloc>& __x, williamr@2: const _STLP_PRIV __bstr_sum<_CharT,_Traits,_Alloc,_Lhs,_Rhs,_StoreDir>& __y) { williamr@2: return basic_string<_CharT,_Traits,_Alloc> ::_M_compare(__x.begin(), __x.end(), williamr@2: __y.begin(), __y.end()) < 0; williamr@2: } williamr@2: #endif /* _STLP_USE_TEMPLATE_EXPRESSION */ williamr@2: williamr@2: template williamr@2: inline bool _STLP_CALL williamr@2: operator<(const _CharT* __s, williamr@2: const basic_string<_CharT,_Traits,_Alloc>& __y) { williamr@2: _STLP_FIX_LITERAL_BUG(__s) williamr@2: size_t __n = _Traits::length(__s); williamr@2: return basic_string<_CharT,_Traits,_Alloc> ::_M_compare(__s, __s + __n, williamr@2: __y.begin(), __y.end()) < 0; williamr@2: } williamr@2: williamr@2: template williamr@2: inline bool _STLP_CALL williamr@2: operator<(const basic_string<_CharT,_Traits,_Alloc>& __x, williamr@2: const _CharT* __s) { williamr@2: _STLP_FIX_LITERAL_BUG(__s) williamr@2: size_t __n = _Traits::length(__s); williamr@2: return basic_string<_CharT,_Traits,_Alloc> ::_M_compare(__x.begin(), __x.end(), williamr@2: __s, __s + __n) < 0; williamr@2: } williamr@2: williamr@2: #if defined (_STLP_USE_TEMPLATE_EXPRESSION) williamr@2: template williamr@2: inline bool _STLP_CALL williamr@2: operator<(const _CharT* __s, williamr@2: const _STLP_PRIV __bstr_sum<_CharT,_Traits,_Alloc,_Lhs,_Rhs,_StoreDir>& __y) { williamr@2: _STLP_FIX_LITERAL_BUG(__s) williamr@2: size_t __n = _Traits::length(__s); williamr@2: return basic_string<_CharT,_Traits,_Alloc> ::_M_compare(__s, __s + __n, williamr@2: __y.begin(), __y.end()) < 0; williamr@2: } williamr@2: williamr@2: template williamr@2: inline bool _STLP_CALL williamr@2: operator<(const _STLP_PRIV __bstr_sum<_CharT,_Traits,_Alloc,_Lhs,_Rhs,_StoreDir>& __x, williamr@2: const _CharT* __s) { williamr@2: _STLP_FIX_LITERAL_BUG(__s) williamr@2: size_t __n = _Traits::length(__s); williamr@2: return basic_string<_CharT,_Traits,_Alloc> ::_M_compare(__x.begin(), __x.end(), williamr@2: __s, __s + __n) < 0; williamr@2: } williamr@2: #endif /* _STLP_USE_TEMPLATE_EXPRESSION */ williamr@2: williamr@2: #if defined (_STLP_USE_SEPARATE_RELOPS_NAMESPACE) williamr@2: williamr@2: /* Only defined if _STLP_USE_SEPARATE_RELOPS_NAMESPACE is defined otherwise williamr@2: * it might introduce ambiguity with pure template relational operators williamr@2: * from rel_ops namespace. williamr@2: */ williamr@2: template williamr@2: inline bool _STLP_CALL williamr@2: operator!=(const basic_string<_CharT,_Traits,_Alloc>& __x, williamr@2: const basic_string<_CharT,_Traits,_Alloc>& __y) williamr@2: { return !(__x == __y); } williamr@2: williamr@2: template williamr@2: inline bool _STLP_CALL williamr@2: operator>(const basic_string<_CharT,_Traits,_Alloc>& __x, williamr@2: const basic_string<_CharT,_Traits,_Alloc>& __y) williamr@2: { return __y < __x; } williamr@2: williamr@2: template williamr@2: inline bool _STLP_CALL williamr@2: operator<=(const basic_string<_CharT,_Traits,_Alloc>& __x, williamr@2: const basic_string<_CharT,_Traits,_Alloc>& __y) williamr@2: { return !(__y < __x); } williamr@2: williamr@2: template williamr@2: inline bool _STLP_CALL williamr@2: operator>=(const basic_string<_CharT,_Traits,_Alloc>& __x, williamr@2: const basic_string<_CharT,_Traits,_Alloc>& __y) williamr@2: { return !(__x < __y); } williamr@2: williamr@2: # if defined (_STLP_USE_TEMPLATE_EXPRESSION) williamr@2: template williamr@2: inline bool _STLP_CALL williamr@2: operator!=(const _STLP_PRIV __bstr_sum<_CharT,_Traits,_Alloc,_Lhs,_Rhs,_StoreDir>& __x, williamr@2: const basic_string<_CharT,_Traits,_Alloc>& __y) williamr@2: { return !(__x==__y); } williamr@2: williamr@2: template williamr@2: inline bool _STLP_CALL williamr@2: operator!=(const basic_string<_CharT,_Traits,_Alloc>& __x, williamr@2: const _STLP_PRIV __bstr_sum<_CharT,_Traits,_Alloc,_Lhs,_Rhs,_StoreDir>& __y) williamr@2: { return !(__x==__y); } williamr@2: # endif williamr@2: williamr@2: #endif /* _STLP_USE_SEPARATE_RELOPS_NAMESPACE */ williamr@2: williamr@2: template williamr@2: inline bool _STLP_CALL williamr@2: operator!=(const _CharT* __s, williamr@2: const basic_string<_CharT,_Traits,_Alloc>& __y) { williamr@2: _STLP_FIX_LITERAL_BUG(__s) williamr@2: return !(__s == __y); williamr@2: } williamr@2: williamr@2: template williamr@2: inline bool _STLP_CALL williamr@2: operator!=(const basic_string<_CharT,_Traits,_Alloc>& __x, williamr@2: const _CharT* __s) { williamr@2: _STLP_FIX_LITERAL_BUG(__s) williamr@2: return !(__x == __s); williamr@2: } williamr@2: williamr@2: #if defined (_STLP_USE_TEMPLATE_EXPRESSION) williamr@2: template williamr@2: inline bool _STLP_CALL williamr@2: operator!=(const _CharT* __s, williamr@2: const _STLP_PRIV __bstr_sum<_CharT,_Traits,_Alloc,_Lhs,_Rhs,_StoreDir>& __y) { williamr@2: _STLP_FIX_LITERAL_BUG(__s) williamr@2: return !(__s == __y); williamr@2: } williamr@2: williamr@2: template williamr@2: inline bool _STLP_CALL williamr@2: operator!=(const _STLP_PRIV __bstr_sum<_CharT,_Traits,_Alloc,_Lhs,_Rhs,_StoreDir>& __x, williamr@2: const _CharT* __s) { williamr@2: _STLP_FIX_LITERAL_BUG(__s) williamr@2: return !(__x == __s); williamr@2: } williamr@2: #endif /* _STLP_USE_TEMPLATE_EXPRESSION */ williamr@2: williamr@2: template williamr@2: inline bool _STLP_CALL williamr@2: operator>(const _CharT* __s, williamr@2: const basic_string<_CharT,_Traits,_Alloc>& __y) { williamr@2: _STLP_FIX_LITERAL_BUG(__s) williamr@2: return __y < __s; williamr@2: } williamr@2: williamr@2: template williamr@2: inline bool _STLP_CALL williamr@2: operator>(const basic_string<_CharT,_Traits,_Alloc>& __x, williamr@2: const _CharT* __s) { williamr@2: _STLP_FIX_LITERAL_BUG(__s) williamr@2: return __s < __x; williamr@2: } williamr@2: williamr@2: #if defined (_STLP_USE_TEMPLATE_EXPRESSION) williamr@2: template williamr@2: inline bool _STLP_CALL williamr@2: operator>(const _CharT* __s, williamr@2: const _STLP_PRIV __bstr_sum<_CharT,_Traits,_Alloc,_Lhs,_Rhs,_StoreDir>& __y) { williamr@2: _STLP_FIX_LITERAL_BUG(__s) williamr@2: return __y < __s; williamr@2: } williamr@2: williamr@2: template williamr@2: inline bool _STLP_CALL williamr@2: operator>(const _STLP_PRIV __bstr_sum<_CharT,_Traits,_Alloc,_Lhs,_Rhs,_StoreDir>& __x, williamr@2: const _CharT* __s) { williamr@2: _STLP_FIX_LITERAL_BUG(__s) williamr@2: return __s < __x; williamr@2: } williamr@2: #endif /* _STLP_USE_TEMPLATE_EXPRESSION */ williamr@2: williamr@2: template williamr@2: inline bool _STLP_CALL williamr@2: operator<=(const _CharT* __s, williamr@2: const basic_string<_CharT,_Traits,_Alloc>& __y) { williamr@2: _STLP_FIX_LITERAL_BUG(__s) williamr@2: return !(__y < __s); williamr@2: } williamr@2: williamr@2: template williamr@2: inline bool _STLP_CALL williamr@2: operator<=(const basic_string<_CharT,_Traits,_Alloc>& __x, williamr@2: const _CharT* __s) { williamr@2: _STLP_FIX_LITERAL_BUG(__s) williamr@2: return !(__s < __x); williamr@2: } williamr@2: williamr@2: #if defined (_STLP_USE_TEMPLATE_EXPRESSION) williamr@2: template williamr@2: inline bool _STLP_CALL williamr@2: operator<=(const _CharT* __s, williamr@2: const _STLP_PRIV __bstr_sum<_CharT,_Traits,_Alloc,_Lhs,_Rhs,_StoreDir>& __y) { williamr@2: _STLP_FIX_LITERAL_BUG(__s) williamr@2: return !(__y < __s); williamr@2: } williamr@2: williamr@2: template williamr@2: inline bool _STLP_CALL williamr@2: operator<=(const _STLP_PRIV __bstr_sum<_CharT,_Traits,_Alloc,_Lhs,_Rhs,_StoreDir>& __x, williamr@2: const _CharT* __s) { williamr@2: _STLP_FIX_LITERAL_BUG(__s) williamr@2: return !(__s < __x); williamr@2: } williamr@2: #endif /* _STLP_USE_TEMPLATE_EXPRESSION */ williamr@2: williamr@2: template williamr@2: inline bool _STLP_CALL williamr@2: operator>=(const _CharT* __s, williamr@2: const basic_string<_CharT,_Traits,_Alloc>& __y) { williamr@2: _STLP_FIX_LITERAL_BUG(__s) williamr@2: return !(__s < __y); williamr@2: } williamr@2: williamr@2: template williamr@2: inline bool _STLP_CALL williamr@2: operator>=(const basic_string<_CharT,_Traits,_Alloc>& __x, williamr@2: const _CharT* __s) { williamr@2: _STLP_FIX_LITERAL_BUG(__s) williamr@2: return !(__x < __s); williamr@2: } williamr@2: williamr@2: #if defined (_STLP_USE_TEMPLATE_EXPRESSION) williamr@2: template williamr@2: inline bool _STLP_CALL williamr@2: operator>=(const _CharT* __s, williamr@2: const _STLP_PRIV __bstr_sum<_CharT,_Traits,_Alloc,_Lhs,_Rhs,_StoreDir>& __y) { williamr@2: _STLP_FIX_LITERAL_BUG(__s) williamr@2: return !(__s < __y); williamr@2: } williamr@2: williamr@2: template williamr@2: inline bool _STLP_CALL williamr@2: operator>=(const _STLP_PRIV __bstr_sum<_CharT,_Traits,_Alloc,_Lhs,_Rhs,_StoreDir>& __x, williamr@2: const _CharT* __s) { williamr@2: _STLP_FIX_LITERAL_BUG(__s) williamr@2: return !(__x < __s); williamr@2: } williamr@2: #endif /* _STLP_USE_TEMPLATE_EXPRESSION */ williamr@2: williamr@2: _STLP_END_NAMESPACE williamr@2: williamr@2: #endif /* _STLP_STRING_OPERATORS_H */ williamr@2: