[multiple changes]

Mon Aug 25 14:26:45 1997  Jason Merrill  <jason@yorick.cygnus.com>

	* Makefile.in (CXXFLAGS): Add -Weffc++.

Sat Aug 23 21:25:37 1997  Mark Mitchell  <mmitchell@usa.net>

	* bastring.h: Enable reverse_iterator and its ilk.

	* bastring.h: Provide specializations of member function templates
	for const_iterator.

From-SVN: r14922
This commit is contained in:
Jason Merrill 1997-08-25 20:27:06 -04:00
parent 922ddba49f
commit 3e68fa8311
3 changed files with 31 additions and 8 deletions

View File

@ -1,3 +1,14 @@
Mon Aug 25 14:26:45 1997 Jason Merrill <jason@yorick.cygnus.com>
* Makefile.in (CXXFLAGS): Add -Weffc++.
Sat Aug 23 21:25:37 1997 Mark Mitchell <mmitchell@usa.net>
* bastring.h: Enable reverse_iterator and its ilk.
* bastring.h: Provide specializations of member function templates
for const_iterator.
Wed Jul 30 10:59:00 1997 Benjamin Kosnik <bkoz@rhino.cygnus.com>
* stlinst.cc: Add instantiation file for

View File

@ -53,7 +53,7 @@ MOSTLYCLEAN_JUNK = *stmp-* tlib*.a *.s *.ii stdlist piclist
CLEAN_JUNK = $(LIBS)
# Remove these for public releases.
CXXFLAGS = -g -O -Wpointer-arith -Wnested-externs -Woverloaded-virtual -Wbad-function-cast -Winline -Wwrite-strings
CXXFLAGS = -g -O -Wpointer-arith -Wnested-externs -Woverloaded-virtual -Wbad-function-cast -Winline -Wwrite-strings -Weffc++
CFLAGS = -g -O -Wpointer-arith -Wnested-externs
.PHONY: libs
@ -292,7 +292,7 @@ stuff:
$(MAKE) clean
$(MAKE) -C ../libio c++clean
$(MAKE) -C ../libg++ clean
$(MAKE) check
$(MAKE) $(MAKEFLAGS) check
$(MAKE) -C ../libio check
$(MAKE) -C ../libg++ check

View File

@ -54,7 +54,7 @@
extern "C++" {
class istream; class ostream;
// #include <iterator.h>
#include <iterator>
template <class charT, class traits = string_char_traits<charT> >
class basic_string
@ -110,12 +110,10 @@ public:
typedef const charT* const_pointer;
typedef pointer iterator;
typedef const_pointer const_iterator;
#if 0
typedef reverse_iterator<iterator, value_type,
reference, difference_type> reverse_iterator;
typedef reverse_iterator<const_iterator, value_type, const_reference,
difference_type> const_reverse_iterator;
#endif
static const size_type npos = static_cast<size_type>(-1);
private:
@ -157,6 +155,9 @@ public:
template<class InputIterator>
basic_string(InputIterator begin, InputIterator end,
Allocator& = Allocator());
#else
basic_string(const_iterator begin, const_iterator end)
: dat (nilRep.grab ()) { assign (begin, end); }
#endif
~basic_string ()
@ -176,6 +177,9 @@ public:
#if 0
template<class InputIterator>
basic_string& append(InputIterator first, InputIterator last);
#else
basic_string& append(const_iterator first, const_iterator last)
{ return replace (length (), 0, first, last - first); }
#endif
basic_string& assign (const basic_string& str, size_type pos = 0,
@ -190,6 +194,9 @@ public:
#if 0
template<class InputIterator>
basic_string& assign(InputIterator first, InputIterator last);
#else
basic_string& assign(const_iterator first, const_iterator last)
{ return replace (0, npos, first, last - first); }
#endif
basic_string& operator= (const charT* s)
@ -220,6 +227,9 @@ public:
#if 0
template<class InputIterator>
void insert(iterator p, InputIterator first, InputIterator last);
#else
void insert(iterator p, const_iterator first, const_iterator last)
{ size_type pos = p - begin(); insert (pos, first, last - first); }
#endif
basic_string& remove (size_type pos = 0, size_type n = npos)
@ -250,6 +260,10 @@ public:
template<class InputIterator>
basic_string& replace(iterator i1, iterator i2,
InputIterator j1, InputIterator j2);
#else
basic_string& replace(iterator i1, iterator i2,
const_iterator j1, const_iterator j2)
{ return replace (i1, i2, j1, j2 - j1); }
#endif
private:
@ -351,14 +365,12 @@ public:
const_iterator begin () const { return &(*rep ())[0]; }
const_iterator end () const { return &(*rep ())[length ()]; }
#if 0
reverse_iterator rbegin() { return reverse_iterator (end ()); }
const_reverse_iterator rbegin() const
{ return const_reverse_iterator (end ()); }
reverse_iterator rend() { return reverse_iterator (begin ()); }
const_reverse_iterator rend() const
{ return const reverse_iterator (begin ()); }
#endif
{ return const_reverse_iterator (begin ()); }
private:
void alloc (size_type size, bool save);