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