OSDN Git Service

Mon Aug 25 14:26:45 1997 Jason Merrill <jason@yorick.cygnus.com>
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 26 Aug 1997 00:27:06 +0000 (00:27 +0000)
committerjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 26 Aug 1997 00:27:06 +0000 (00:27 +0000)
* 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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@14922 138bc75d-0d04-0410-961f-82ee72b054a4

libstdc++/ChangeLog
libstdc++/Makefile.in
libstdc++/std/bastring.h

index 48eb554..4eace63 100644 (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 
index 0858516..79d8d88 100644 (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
 
index 5a2605b..98c7d44 100644 (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);