diff options
author | Jody Goldberg <jodyg@idt.net> | 1997-12-07 10:41:01 +0000 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 1997-12-07 05:41:01 -0500 |
commit | 4ef0de1177b5000d3dd444606b9bdbb736e3c6bf (patch) | |
tree | d904341aa74a2d332d4e2b981e699ee70baa72c3 /libstdc++/std | |
parent | 179b008f3e37dc8d713e78509fda6461dc203921 (diff) | |
download | gcc-4ef0de1177b5000d3dd444606b9bdbb736e3c6bf.tar.gz |
bastring.h: Move closer to the draft standard implementation of basic_string by adding 3...
Sun Dec 7 02:34:40 1997 Jody Goldberg <jodyg@idt.net>
* libstdc++/std/bastring.h : Move closer to the draft standard
implementation of basic_string by adding 3 paramter 'Allocator'.
NOTE: this still differs from the standard in not offering per
instance allocators.
* libstdc++/std/bastring.cc : Likewise.
* libstdc++/stlinst.cc : Handle thread safe allocators if they are the
default.
From-SVN: r16993
Diffstat (limited to 'libstdc++/std')
-rw-r--r-- | libstdc++/std/bastring.cc | 218 | ||||
-rw-r--r-- | libstdc++/std/bastring.h | 159 |
2 files changed, 204 insertions, 173 deletions
diff --git a/libstdc++/std/bastring.cc b/libstdc++/std/bastring.cc index 444797096dc..b5be65f3ee3 100644 --- a/libstdc++/std/bastring.cc +++ b/libstdc++/std/bastring.cc @@ -29,15 +29,24 @@ #include <std/bastring.h> extern "C++" { -template <class charT, class traits> -inline void * basic_string <charT, traits>::Rep:: +template <class charT, class traits, class Allocator> +inline void * basic_string <charT, traits, Allocator>::Rep:: operator new (size_t s, size_t extra) { - return ::operator new (s + extra * sizeof (charT)); + return Allocator::allocate(s + extra * sizeof (charT)); } -template <class charT, class traits> -inline size_t basic_string <charT, traits>::Rep:: +template <class charT, class traits, class Allocator> +inline void basic_string <charT, traits, Allocator>::Rep:: +operator delete (void * ptr) +{ + return Allocator::deallocate(ptr, sizeof(Rep) + + reinterpret_cast<Rep *>(ptr)->res * + sizeof (charT)); +} + +template <class charT, class traits, class Allocator> +inline size_t basic_string <charT, traits, Allocator>::Rep:: #if _G_ALLOC_CONTROL default_frob (size_t s) #else @@ -49,8 +58,9 @@ frob_size (size_t s) return i; } -template <class charT, class traits> -inline basic_string <charT, traits>::Rep * basic_string <charT, traits>::Rep:: +template <class charT, class traits, class Allocator> +inline basic_string <charT, traits, Allocator>::Rep * +basic_string <charT, traits, Allocator>::Rep:: create (size_t extra) { extra = frob_size (extra + 1); @@ -61,8 +71,8 @@ create (size_t extra) return p; } -template <class charT, class traits> -charT * basic_string <charT, traits>::Rep:: +template <class charT, class traits, class Allocator> +charT * basic_string <charT, traits, Allocator>::Rep:: clone () { Rep *p = Rep::create (len); @@ -71,8 +81,8 @@ clone () return p->data (); } -template <class charT, class traits> -inline bool basic_string <charT, traits>::Rep:: +template <class charT, class traits, class Allocator> +inline bool basic_string <charT, traits, Allocator>::Rep:: #ifdef _G_ALLOC_CONTROL default_excess (size_t s, size_t r) #else @@ -82,9 +92,9 @@ excess_slop (size_t s, size_t r) return 2 * (s <= 16 ? 16 : s) < r; } -template <class charT, class traits> -inline bool basic_string <charT, traits>:: -check_realloc (size_t s) const +template <class charT, class traits, class Allocator> +inline bool basic_string <charT, traits, Allocator>:: +check_realloc (basic_string::size_type s) const { s += sizeof (charT); rep ()->selfish = false; @@ -93,9 +103,9 @@ check_realloc (size_t s) const || Rep::excess_slop (s, capacity ())); } -template <class charT, class traits> -void basic_string <charT, traits>:: -alloc (size_t size, bool save) +template <class charT, class traits, class Allocator> +void basic_string <charT, traits, Allocator>:: +alloc (basic_string::size_type size, bool save) { if (! check_realloc (size)) return; @@ -113,10 +123,11 @@ alloc (size_t size, bool save) repup (p); } -template <class charT, class traits> -basic_string <charT, traits>& basic_string <charT, traits>:: -replace (size_t pos1, size_t n1, - const basic_string& str, size_t pos2, size_t n2) +template <class charT, class traits, class Allocator> +basic_string <charT, traits, Allocator>& +basic_string <charT, traits, Allocator>:: +replace (size_type pos1, size_type n1, + const basic_string& str, size_type pos2, size_type n2) { const size_t len2 = str.length (); @@ -131,27 +142,28 @@ replace (size_t pos1, size_t n1, return replace (pos1, n1, str.data () + pos2, n2); } -template <class charT, class traits> -inline void basic_string <charT, traits>::Rep:: +template <class charT, class traits, class Allocator> +inline void basic_string <charT, traits, Allocator>::Rep:: copy (size_t pos, const charT *s, size_t n) { if (n) traits::copy (data () + pos, s, n); } -template <class charT, class traits> -inline void basic_string <charT, traits>::Rep:: +template <class charT, class traits, class Allocator> +inline void basic_string <charT, traits, Allocator>::Rep:: move (size_t pos, const charT *s, size_t n) { if (n) traits::move (data () + pos, s, n); } -template <class charT, class traits> -basic_string <charT, traits>& basic_string <charT, traits>:: -replace (size_t pos, size_t n1, const charT* s, size_t n2) +template <class charT, class traits, class Allocator> +basic_string <charT, traits, Allocator>& +basic_string <charT, traits, Allocator>:: +replace (size_type pos, size_type n1, const charT* s, size_type n2) { - const size_t len = length (); + const size_type len = length (); OUTOFRANGE (pos > len); if (n1 > len - pos) n1 = len - pos; @@ -176,16 +188,16 @@ replace (size_t pos, size_t n1, const charT* s, size_t n2) return *this; } -template <class charT, class traits> -inline void basic_string <charT, traits>::Rep:: +template <class charT, class traits, class Allocator> +inline void basic_string <charT, traits, Allocator>::Rep:: set (size_t pos, const charT c, size_t n) { traits::set (data () + pos, c, n); } -template <class charT, class traits> -basic_string <charT, traits>& basic_string <charT, traits>:: -replace (size_t pos, size_t n1, size_t n2, charT c) +template <class charT, class traits, class Allocator> +basic_string <charT, traits, Allocator>& basic_string <charT, traits, Allocator>:: +replace (size_type pos, size_type n1, size_type n2, charT c) { const size_t len = length (); OUTOFRANGE (pos > len); @@ -212,9 +224,9 @@ replace (size_t pos, size_t n1, size_t n2, charT c) return *this; } -template <class charT, class traits> -void basic_string <charT, traits>:: -resize (size_t n, charT c) +template <class charT, class traits, class Allocator> +void basic_string <charT, traits, Allocator>:: +resize (size_type n, charT c) { LENGTHERROR (n > max_size ()); @@ -224,9 +236,10 @@ resize (size_t n, charT c) erase (n); } -template <class charT, class traits> -size_t basic_string <charT, traits>:: -copy (charT* s, size_t n, size_t pos) +template <class charT, class traits, class Allocator> +basic_string <charT, traits, Allocator>::size_type +basic_string <charT, traits, Allocator>:: +copy (charT* s, size_type n, size_type pos) { OUTOFRANGE (pos > length ()); @@ -237,9 +250,10 @@ copy (charT* s, size_t n, size_t pos) return n; } -template <class charT, class traits> -size_t basic_string <charT, traits>:: -find (const charT* s, size_t pos, size_t n) const +template <class charT, class traits, class Allocator> +basic_string <charT, traits, Allocator>::size_type +basic_string <charT, traits, Allocator>:: +find (const charT* s, size_type pos, size_type n) const { size_t xpos = pos; for (; xpos + n <= length (); ++xpos) @@ -249,9 +263,10 @@ find (const charT* s, size_t pos, size_t n) const return npos; } -template <class charT, class traits> -inline size_t basic_string <charT, traits>:: -_find (const charT* ptr, charT c, size_t xpos, size_t len) +template <class charT, class traits, class Allocator> +inline basic_string <charT, traits, Allocator>::size_type +basic_string <charT, traits, Allocator>:: +_find (const charT* ptr, charT c, size_type xpos, size_type len) { for (; xpos < len; ++xpos) if (traits::eq (ptr [xpos], c)) @@ -259,16 +274,18 @@ _find (const charT* ptr, charT c, size_t xpos, size_t len) return npos; } -template <class charT, class traits> -size_t basic_string <charT, traits>:: -find (charT c, size_t pos) const +template <class charT, class traits, class Allocator> +basic_string <charT, traits, Allocator>::size_type +basic_string <charT, traits, Allocator>:: +find (charT c, size_type pos) const { return _find (data (), c, pos, length ()); } -template <class charT, class traits> -size_t basic_string <charT, traits>:: -rfind (const charT* s, size_t pos, size_t n) const +template <class charT, class traits, class Allocator> +basic_string <charT, traits, Allocator>::size_type +basic_string <charT, traits, Allocator>:: +rfind (const charT* s, size_type pos, size_type n) const { if (n > length ()) return npos; @@ -284,9 +301,10 @@ rfind (const charT* s, size_t pos, size_t n) const return npos; } -template <class charT, class traits> -size_t basic_string <charT, traits>:: -rfind (charT c, size_t pos) const +template <class charT, class traits, class Allocator> +basic_string <charT, traits, Allocator>::size_type +basic_string <charT, traits, Allocator>:: +rfind (charT c, size_type pos) const { if (1 > length ()) return npos; @@ -301,9 +319,10 @@ rfind (charT c, size_t pos) const return npos; } -template <class charT, class traits> -size_t basic_string <charT, traits>:: -find_first_of (const charT* s, size_t pos, size_t n) const +template <class charT, class traits, class Allocator> +basic_string <charT, traits, Allocator>::size_type +basic_string <charT, traits, Allocator>:: +find_first_of (const charT* s, size_type pos, size_type n) const { size_t xpos = pos; for (; xpos < length (); ++xpos) @@ -312,9 +331,10 @@ find_first_of (const charT* s, size_t pos, size_t n) const return npos; } -template <class charT, class traits> -size_t basic_string <charT, traits>:: -find_last_of (const charT* s, size_t pos, size_t n) const +template <class charT, class traits, class Allocator> +basic_string <charT, traits, Allocator>::size_type +basic_string <charT, traits, Allocator>:: +find_last_of (const charT* s, size_type pos, size_type n) const { size_t xpos = length () - 1; if (xpos > pos) @@ -325,9 +345,10 @@ find_last_of (const charT* s, size_t pos, size_t n) const return npos; } -template <class charT, class traits> -size_t basic_string <charT, traits>:: -find_first_not_of (const charT* s, size_t pos, size_t n) const +template <class charT, class traits, class Allocator> +basic_string <charT, traits, Allocator>::size_type +basic_string <charT, traits, Allocator>:: +find_first_not_of (const charT* s, size_type pos, size_type n) const { size_t xpos = pos; for (; xpos < length (); ++xpos) @@ -336,9 +357,10 @@ find_first_not_of (const charT* s, size_t pos, size_t n) const return npos; } -template <class charT, class traits> -size_t basic_string <charT, traits>:: -find_first_not_of (charT c, size_t pos) const +template <class charT, class traits, class Allocator> +basic_string <charT, traits, Allocator>::size_type +basic_string <charT, traits, Allocator>:: +find_first_not_of (charT c, size_type pos) const { size_t xpos = pos; for (; xpos < length (); ++xpos) @@ -347,9 +369,10 @@ find_first_not_of (charT c, size_t pos) const return npos; } -template <class charT, class traits> -size_t basic_string <charT, traits>:: -find_last_not_of (const charT* s, size_t pos, size_t n) const +template <class charT, class traits, class Allocator> +basic_string <charT, traits, Allocator>::size_type +basic_string <charT, traits, Allocator>:: +find_last_not_of (const charT* s, size_type pos, size_type n) const { size_t xpos = length () - 1; if (xpos > pos) @@ -360,9 +383,10 @@ find_last_not_of (const charT* s, size_t pos, size_t n) const return npos; } -template <class charT, class traits> -size_t basic_string <charT, traits>:: -find_last_not_of (charT c, size_t pos) const +template <class charT, class traits, class Allocator> +basic_string <charT, traits, Allocator>::size_type +basic_string <charT, traits, Allocator>:: +find_last_not_of (charT c, size_type pos) const { size_t xpos = length () - 1; if (xpos > pos) @@ -373,9 +397,9 @@ find_last_not_of (charT c, size_t pos) const return npos; } -template <class charT, class traits> -int basic_string <charT, traits>:: -compare (const basic_string& str, size_t pos, size_t n) const +template <class charT, class traits, class Allocator> +int basic_string <charT, traits, Allocator>:: +compare (const basic_string& str, size_type pos, size_type n) const { OUTOFRANGE (pos > length ()); @@ -392,9 +416,9 @@ compare (const basic_string& str, size_t pos, size_t n) const return (length () - pos) - str.length (); } -template <class charT, class traits> -int basic_string <charT, traits>:: -compare (const charT* s, size_t pos, size_t n) const +template <class charT, class traits, class Allocator> +int basic_string <charT, traits, Allocator>:: +compare (const charT* s, size_type pos, size_type n) const { OUTOFRANGE (pos > length ()); @@ -409,9 +433,9 @@ compare (const charT* s, size_t pos, size_t n) const #include <iostream.h> -template <class charT, class traits> +template <class charT, class traits, class Allocator> istream & -operator>> (istream &is, basic_string <charT, traits> &s) +operator>> (istream &is, basic_string <charT, traits, Allocator> &s) { int w = is.width (0); if (is.ipfx0 ()) @@ -444,16 +468,16 @@ operator>> (istream &is, basic_string <charT, traits> &s) return is; } -template <class charT, class traits> +template <class charT, class traits, class Allocator> ostream & -operator<< (ostream &o, const basic_string <charT, traits>& s) +operator<< (ostream &o, const basic_string <charT, traits, Allocator>& s) { return o.write (s.data (), s.length ()); } -template <class charT, class traits> +template <class charT, class traits, class Allocator> istream& -getline (istream &is, basic_string <charT, traits>& s, charT delim) +getline (istream &is, basic_string <charT, traits, Allocator>& s, charT delim) { if (is.ipfx1 ()) { @@ -494,22 +518,22 @@ getline (istream &is, basic_string <charT, traits>& s, charT delim) return is; } -template <class charT, class traits> -basic_string <charT, traits>::Rep -basic_string<charT, traits>::nilRep = { 0, 0, 1 }; +template <class charT, class traits, class Allocator> +basic_string <charT, traits, Allocator>::Rep +basic_string<charT, traits, Allocator>::nilRep = { 0, 0, 1 }; -template <class charT, class traits> -const basic_string <charT, traits>::size_type -basic_string <charT, traits>::npos; +template <class charT, class traits, class Allocator> +const basic_string <charT, traits, Allocator>::size_type +basic_string <charT, traits, Allocator>::npos; #ifdef _G_ALLOC_CONTROL -template <class charT, class traits> -bool (*basic_string <charT, traits>::Rep::excess_slop) (size_t, size_t) - = basic_string <charT, traits>::Rep::default_excess; +template <class charT, class traits, class Allocator> +bool (*basic_string <charT, traits, Allocator>::Rep::excess_slop) (size_t, size_t) + = basic_string <charT, traits, Allocator>::Rep::default_excess; -template <class charT, class traits> -size_t (*basic_string <charT, traits>::Rep::frob_size) (size_t) - = basic_string <charT, traits>::Rep::default_frob; +template <class charT, class traits, class Allocator> +size_t (*basic_string <charT, traits, Allocator>::Rep::frob_size) (size_t) + = basic_string <charT, traits, Allocator>::Rep::default_frob; #endif } // extern "C++" diff --git a/libstdc++/std/bastring.h b/libstdc++/std/bastring.h index f8fe279b158..5b1d651e00f 100644 --- a/libstdc++/std/bastring.h +++ b/libstdc++/std/bastring.h @@ -35,6 +35,9 @@ #include <cstddef> #include <std/straits.h> +// NOTE : This does NOT conform to the draft standard and is likely to change +#include <alloc.h> + extern "C++" { class istream; class ostream; @@ -58,7 +61,8 @@ extern void __length_error (const char *); #endif -template <class charT, class traits = string_char_traits<charT> > +template <class charT, class traits = string_char_traits<charT>, + class Allocator = alloc > class basic_string { private: @@ -72,6 +76,7 @@ private: void release () { if (--ref == 0) delete this; } inline static void * operator new (size_t, size_t); + inline static void operator delete (void *); inline static Rep* create (size_t); charT* clone (); @@ -102,8 +107,10 @@ private: public: // types: - typedef traits traits_type; - typedef charT value_type; + typedef traits traits_type; + typedef typename traits::char_type value_type; + typedef Allocator allocator_type; + typedef size_t size_type; typedef ptrdiff_t difference_type; typedef charT& reference; @@ -386,12 +393,12 @@ private: }; #ifdef __STL_MEMBER_TEMPLATES -template <class charT, class traits> template <class InputIterator> -basic_string <charT, traits>& basic_string <charT, traits>:: +template <class charT, class traits, class Allocator> template <class InputIterator> +basic_string <charT, traits, Allocator>& basic_string <charT, traits, Allocator>:: replace (iterator i1, iterator i2, InputIterator j1, InputIterator j2) #else -template <class charT, class traits> -basic_string <charT, traits>& basic_string <charT, traits>:: +template <class charT, class traits, class Allocator> +basic_string <charT, traits, Allocator>& basic_string <charT, traits, Allocator>:: replace (iterator i1, iterator i2, const_iterator j1, const_iterator j2) #endif { @@ -426,191 +433,191 @@ replace (iterator i1, iterator i2, const_iterator j1, const_iterator j2) return *this; } -template <class charT, class traits> -inline basic_string <charT, traits> -operator+ (const basic_string <charT, traits>& lhs, - const basic_string <charT, traits>& rhs) +template <class charT, class traits, class Allocator> +inline basic_string <charT, traits, Allocator> +operator+ (const basic_string <charT, traits, Allocator>& lhs, + const basic_string <charT, traits, Allocator>& rhs) { - basic_string <charT, traits> str (lhs); + basic_string <charT, traits, Allocator> str (lhs); str.append (rhs); return str; } -template <class charT, class traits> -inline basic_string <charT, traits> -operator+ (const charT* lhs, const basic_string <charT, traits>& rhs) +template <class charT, class traits, class Allocator> +inline basic_string <charT, traits, Allocator> +operator+ (const charT* lhs, const basic_string <charT, traits, Allocator>& rhs) { - basic_string <charT, traits> str (lhs); + basic_string <charT, traits, Allocator> str (lhs); str.append (rhs); return str; } -template <class charT, class traits> -inline basic_string <charT, traits> -operator+ (charT lhs, const basic_string <charT, traits>& rhs) +template <class charT, class traits, class Allocator> +inline basic_string <charT, traits, Allocator> +operator+ (charT lhs, const basic_string <charT, traits, Allocator>& rhs) { - basic_string <charT, traits> str (1, lhs); + basic_string <charT, traits, Allocator> str (1, lhs); str.append (rhs); return str; } -template <class charT, class traits> -inline basic_string <charT, traits> -operator+ (const basic_string <charT, traits>& lhs, const charT* rhs) +template <class charT, class traits, class Allocator> +inline basic_string <charT, traits, Allocator> +operator+ (const basic_string <charT, traits, Allocator>& lhs, const charT* rhs) { - basic_string <charT, traits> str (lhs); + basic_string <charT, traits, Allocator> str (lhs); str.append (rhs); return str; } -template <class charT, class traits> -inline basic_string <charT, traits> -operator+ (const basic_string <charT, traits>& lhs, charT rhs) +template <class charT, class traits, class Allocator> +inline basic_string <charT, traits, Allocator> +operator+ (const basic_string <charT, traits, Allocator>& lhs, charT rhs) { - basic_string <charT, traits> str (lhs); + basic_string <charT, traits, Allocator> str (lhs); str.append (1, rhs); return str; } -template <class charT, class traits> +template <class charT, class traits, class Allocator> inline bool -operator== (const basic_string <charT, traits>& lhs, - const basic_string <charT, traits>& rhs) +operator== (const basic_string <charT, traits, Allocator>& lhs, + const basic_string <charT, traits, Allocator>& rhs) { return (lhs.compare (rhs) == 0); } -template <class charT, class traits> +template <class charT, class traits, class Allocator> inline bool -operator== (const charT* lhs, const basic_string <charT, traits>& rhs) +operator== (const charT* lhs, const basic_string <charT, traits, Allocator>& rhs) { return (rhs.compare (lhs) == 0); } -template <class charT, class traits> +template <class charT, class traits, class Allocator> inline bool -operator== (const basic_string <charT, traits>& lhs, const charT* rhs) +operator== (const basic_string <charT, traits, Allocator>& lhs, const charT* rhs) { return (lhs.compare (rhs) == 0); } -template <class charT, class traits> +template <class charT, class traits, class Allocator> inline bool -operator!= (const charT* lhs, const basic_string <charT, traits>& rhs) +operator!= (const charT* lhs, const basic_string <charT, traits, Allocator>& rhs) { return (rhs.compare (lhs) != 0); } -template <class charT, class traits> +template <class charT, class traits, class Allocator> inline bool -operator!= (const basic_string <charT, traits>& lhs, const charT* rhs) +operator!= (const basic_string <charT, traits, Allocator>& lhs, const charT* rhs) { return (lhs.compare (rhs) != 0); } -template <class charT, class traits> +template <class charT, class traits, class Allocator> inline bool -operator< (const basic_string <charT, traits>& lhs, - const basic_string <charT, traits>& rhs) +operator< (const basic_string <charT, traits, Allocator>& lhs, + const basic_string <charT, traits, Allocator>& rhs) { return (lhs.compare (rhs) < 0); } -template <class charT, class traits> +template <class charT, class traits, class Allocator> inline bool -operator< (const charT* lhs, const basic_string <charT, traits>& rhs) +operator< (const charT* lhs, const basic_string <charT, traits, Allocator>& rhs) { return (rhs.compare (lhs) > 0); } -template <class charT, class traits> +template <class charT, class traits, class Allocator> inline bool -operator< (const basic_string <charT, traits>& lhs, const charT* rhs) +operator< (const basic_string <charT, traits, Allocator>& lhs, const charT* rhs) { return (lhs.compare (rhs) < 0); } -template <class charT, class traits> +template <class charT, class traits, class Allocator> inline bool -operator> (const charT* lhs, const basic_string <charT, traits>& rhs) +operator> (const charT* lhs, const basic_string <charT, traits, Allocator>& rhs) { return (rhs.compare (lhs) < 0); } -template <class charT, class traits> +template <class charT, class traits, class Allocator> inline bool -operator> (const basic_string <charT, traits>& lhs, const charT* rhs) +operator> (const basic_string <charT, traits, Allocator>& lhs, const charT* rhs) { return (lhs.compare (rhs) > 0); } -template <class charT, class traits> +template <class charT, class traits, class Allocator> inline bool -operator<= (const charT* lhs, const basic_string <charT, traits>& rhs) +operator<= (const charT* lhs, const basic_string <charT, traits, Allocator>& rhs) { return (rhs.compare (lhs) >= 0); } -template <class charT, class traits> +template <class charT, class traits, class Allocator> inline bool -operator<= (const basic_string <charT, traits>& lhs, const charT* rhs) +operator<= (const basic_string <charT, traits, Allocator>& lhs, const charT* rhs) { return (lhs.compare (rhs) <= 0); } -template <class charT, class traits> +template <class charT, class traits, class Allocator> inline bool -operator>= (const charT* lhs, const basic_string <charT, traits>& rhs) +operator>= (const charT* lhs, const basic_string <charT, traits, Allocator>& rhs) { return (rhs.compare (lhs) <= 0); } -template <class charT, class traits> +template <class charT, class traits, class Allocator> inline bool -operator>= (const basic_string <charT, traits>& lhs, const charT* rhs) +operator>= (const basic_string <charT, traits, Allocator>& lhs, const charT* rhs) { return (lhs.compare (rhs) >= 0); } -template <class charT, class traits> +template <class charT, class traits, class Allocator> inline bool -operator!= (const basic_string <charT, traits>& lhs, - const basic_string <charT, traits>& rhs) +operator!= (const basic_string <charT, traits, Allocator>& lhs, + const basic_string <charT, traits, Allocator>& rhs) { return (lhs.compare (rhs) != 0); } -template <class charT, class traits> +template <class charT, class traits, class Allocator> inline bool -operator> (const basic_string <charT, traits>& lhs, - const basic_string <charT, traits>& rhs) +operator> (const basic_string <charT, traits, Allocator>& lhs, + const basic_string <charT, traits, Allocator>& rhs) { return (lhs.compare (rhs) > 0); } -template <class charT, class traits> +template <class charT, class traits, class Allocator> inline bool -operator<= (const basic_string <charT, traits>& lhs, - const basic_string <charT, traits>& rhs) +operator<= (const basic_string <charT, traits, Allocator>& lhs, + const basic_string <charT, traits, Allocator>& rhs) { return (lhs.compare (rhs) <= 0); } -template <class charT, class traits> +template <class charT, class traits, class Allocator> inline bool -operator>= (const basic_string <charT, traits>& lhs, - const basic_string <charT, traits>& rhs) +operator>= (const basic_string <charT, traits, Allocator>& lhs, + const basic_string <charT, traits, Allocator>& rhs) { return (lhs.compare (rhs) >= 0); } class istream; class ostream; -template <class charT, class traits> istream& -operator>> (istream&, basic_string <charT, traits>&); -template <class charT, class traits> ostream& -operator<< (ostream&, const basic_string <charT, traits>&); -template <class charT, class traits> istream& -getline (istream&, basic_string <charT, traits>&, charT delim = '\n'); +template <class charT, class traits, class Allocator> istream& +operator>> (istream&, basic_string <charT, traits, Allocator>&); +template <class charT, class traits, class Allocator> ostream& +operator<< (ostream&, const basic_string <charT, traits, Allocator>&); +template <class charT, class traits, class Allocator> istream& +getline (istream&, basic_string <charT, traits, Allocator>&, charT delim = '\n'); } // extern "C++" |