From 3e68fa831129e7717a961aeda8358e62d3d467e9 Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Mon, 25 Aug 1997 20:27:06 -0400 Subject: [PATCH] [multiple changes] Mon Aug 25 14:26:45 1997 Jason Merrill * Makefile.in (CXXFLAGS): Add -Weffc++. Sat Aug 23 21:25:37 1997 Mark Mitchell * bastring.h: Enable reverse_iterator and its ilk. * bastring.h: Provide specializations of member function templates for const_iterator. From-SVN: r14922 --- libstdc++/ChangeLog | 11 +++++++++++ libstdc++/Makefile.in | 4 ++-- libstdc++/std/bastring.h | 24 ++++++++++++++++++------ 3 files changed, 31 insertions(+), 8 deletions(-) diff --git a/libstdc++/ChangeLog b/libstdc++/ChangeLog index 48eb5543a18..4eace634775 100644 --- a/libstdc++/ChangeLog +++ b/libstdc++/ChangeLog @@ -1,3 +1,14 @@ +Mon Aug 25 14:26:45 1997 Jason Merrill + + * Makefile.in (CXXFLAGS): Add -Weffc++. + +Sat Aug 23 21:25:37 1997 Mark Mitchell + + * 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 * stlinst.cc: Add instantiation file for diff --git a/libstdc++/Makefile.in b/libstdc++/Makefile.in index 0858516fda5..79d8d88e500 100644 --- a/libstdc++/Makefile.in +++ b/libstdc++/Makefile.in @@ -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 diff --git a/libstdc++/std/bastring.h b/libstdc++/std/bastring.h index 5a2605bd050..98c7d44b688 100644 --- a/libstdc++/std/bastring.h +++ b/libstdc++/std/bastring.h @@ -54,7 +54,7 @@ extern "C++" { class istream; class ostream; -// #include +#include template > 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 reverse_iterator; typedef reverse_iterator const_reverse_iterator; -#endif static const size_type npos = static_cast(-1); private: @@ -157,6 +155,9 @@ public: template 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 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 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 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 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); -- 2.30.2