string and member templates
Joe Buck
jbuck@synopsys.com
Thu Sep 25 16:45:00 GMT 1997
I see that the member template code in std/bastring.h is ifdef'ed out
with #if 0. I suggest that this be changed to
#ifdef __STL_MEMBER_TEMPLATES
to match the STL classes; that way the flag can be set only once (e.g.
one way for egcs, the other for gcc2 snapshots until member templates
are merged).
#include <stl_config.h> to pick up the definition.
Here's a patch; I've verified that tstring still works, though it
doesn't really exercise these functions.
*** bastring.h.970924 Mon Sep 22 13:57:12 1997
--- bastring.h Thu Sep 25 16:36:49 1997
***************
*** 34,39 ****
--- 34,40 ----
#include <cstddef>
#include <std/straits.h>
+ #include <stl_config.h>
#if _G_USE_EXCEPTIONS
***************
*** 149,155 ****
: dat (nilRep.grab ()) { assign (s); }
basic_string (size_type n, charT c)
: dat (nilRep.grab ()) { assign (n, c); }
! #if 0
template<class InputIterator>
basic_string(InputIterator begin, InputIterator end,
Allocator& = Allocator());
--- 150,156 ----
: dat (nilRep.grab ()) { assign (s); }
basic_string (size_type n, charT c)
: dat (nilRep.grab ()) { assign (n, c); }
! #ifdef __STL_MEMBER_TEMPLATES
template<class InputIterator>
basic_string(InputIterator begin, InputIterator end,
Allocator& = Allocator());
***************
*** 172,178 ****
{ return append (s, traits::length (s)); }
basic_string& append (size_type n, charT c)
{ return replace (length (), 0, n, c); }
! #if 0
template<class InputIterator>
basic_string& append(InputIterator first, InputIterator last);
#else
--- 173,179 ----
{ return append (s, traits::length (s)); }
basic_string& append (size_type n, charT c)
{ return replace (length (), 0, n, c); }
! #ifdef __STL_MEMBER_TEMPLATES
template<class InputIterator>
basic_string& append(InputIterator first, InputIterator last);
#else
***************
*** 189,195 ****
{ return assign (s, traits::length (s)); }
basic_string& assign (size_type n, charT c)
{ return replace (0, npos, n, c); }
! #if 0
template<class InputIterator>
basic_string& assign(InputIterator first, InputIterator last);
#else
--- 190,196 ----
{ return assign (s, traits::length (s)); }
basic_string& assign (size_type n, charT c)
{ return replace (0, npos, n, c); }
! #ifdef __STL_MEMBER_TEMPLATES
template<class InputIterator>
basic_string& assign(InputIterator first, InputIterator last);
#else
***************
*** 222,228 ****
{ size_type pos = p - begin (); insert (pos, 1, c); return pos +begin (); }
iterator insert(iterator p, size_type n, charT c)
{ size_type pos = p - begin (); insert (pos, n, c); return pos +begin (); }
! #if 0
template<class InputIterator>
void insert(iterator p, InputIterator first, InputIterator last);
#else
--- 223,229 ----
{ size_type pos = p - begin (); insert (pos, 1, c); return pos +begin (); }
iterator insert(iterator p, size_type n, charT c)
{ size_type pos = p - begin (); insert (pos, n, c); return pos +begin (); }
! #ifdef __STL_MEMBER_TEMPLATES
template<class InputIterator>
void insert(iterator p, InputIterator first, InputIterator last);
#else
***************
*** 254,260 ****
{ return replace (i1 - begin (), i2 - i1, s); }
basic_string& replace (iterator i1, iterator i2, size_type n, charT c)
{ return replace (i1 - begin (), i2 - i1, n, c); }
! #if 0
template<class InputIterator>
basic_string& replace(iterator i1, iterator i2,
InputIterator j1, InputIterator j2);
--- 255,261 ----
{ return replace (i1 - begin (), i2 - i1, s); }
basic_string& replace (iterator i1, iterator i2, size_type n, charT c)
{ return replace (i1 - begin (), i2 - i1, n, c); }
! #ifdef __STL_MEMBER_TEMPLATES
template<class InputIterator>
basic_string& replace(iterator i1, iterator i2,
InputIterator j1, InputIterator j2);
More information about the Gcc
mailing list