This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch] : more delegation in stl_algo.h


Chris Jefferson wrote:

Apart from that, this patch is hopefully mostly fairly obvious, with the exception that replace_copy of used to have a construct "z = p ? x : y" which I've replaced with "if(z) p=x else p=y", as in theory x and y can be of different types, neither convertable to the other but both convertable to typeof(z).

For now, I have added the below: testcases + minor tweaks + fix to replace_copy & replace_copy_if (fixed the check_type testcase of the latter).


I'm afraid, a complete solution for the empty struct issue is not beyond the corner, therefore we should deal first with search/search_n, making sure that we don't regress performance-wise wrt mainline. Probably, I will do some benchmarks. Only later, hopefully, proceed with more delegations.

Seems also a nice idea porting the complete set of testcases for <algorithm> (+ minor tweaks) to mainline: if nobody objects will do soon.

Paolo.

///////////////
2005-03-14  Christopher Jefferson  <chris@bubblescope.net>

	* include/bits/stl_algo.h (replace_copy, replace_copy_of):
	Don't assume that __new_value and *__first are convertible to
	each other.	

	* include/bits/stl_algobase.h (min): Readd lost comment.
	* include/bits/predefined_ops.h (equal_to::operator(),
	less::operator()): Add const.
	* testsuite/testsuite_iterators.h (WritableObject::WritableObject):
	Add const.
	* testsuite/25_algorithms/find/1.cc: New.
	* testsuite/25_algorithms/find/check_type.cc: New.
	* testsuite/25_algorithms/find_if/1.cc: New.
	* testsuite/25_algorithms/find_if/check_type.cc: New.
	* testsuite/25_algorithms/replace/1.cc: New.
	* testsuite/25_algorithms/replace/check_type.cc: New.
	* testsuite/25_algorithms/replace_if/1.cc: New.
	* testsuite/25_algorithms/replace_if/check_type.cc: New.
	* testsuite/25_algorithms/replace_copy/1.cc: New.
	* testsuite/25_algorithms/replace_copy/check_type.cc: New.
	* testsuite/25_algorithms/replace_copy_if/1.cc: New.
	* testsuite/25_algorithms/replace_copy_if/check_type.cc: New.
	* testsuite/25_algorithms/remove/1.cc: New.
	* testsuite/25_algorithms/remove/check_type.cc: New.
	* testsuite/25_algorithms/remove_if/1.cc: New.
	* testsuite/25_algorithms/remove_if/check_type.cc: New.
	* testsuite/25_algorithms/count/1.cc: New.
	* testsuite/25_algorithms/count/check_type.cc: New.
	* testsuite/25_algorithms/count_if/1.cc: New.
	* testsuite/25_algorithms/count_if/check_type.cc: New.
diff -urN libstdc++-v3-orig/include/bits/predefined_ops.h libstdc++-v3/include/bits/predefined_ops.h
--- libstdc++-v3-orig/include/bits/predefined_ops.h	2005-01-10 11:52:11.000000000 +0100
+++ libstdc++-v3/include/bits/predefined_ops.h	2005-03-14 10:31:47.000000000 +0100
@@ -43,7 +43,7 @@
   {
     template<typename _Lhs, typename _Rhs>
       bool
-      operator()(const _Lhs& __lhs, const _Rhs& __rhs)
+      operator()(const _Lhs& __lhs, const _Rhs& __rhs) const
       { return __lhs < __rhs; }
   };
 
@@ -51,7 +51,7 @@
   {
     template<typename _Lhs, typename _Rhs>
       bool
-      operator()(const _Lhs& __lhs, const _Rhs& __rhs)
+      operator()(const _Lhs& __lhs, const _Rhs& __rhs) const
       { return __lhs == __rhs; }
   };
 } // namespace __ops
diff -urN libstdc++-v3-orig/include/bits/stl_algo.h libstdc++-v3/include/bits/stl_algo.h
--- libstdc++-v3-orig/include/bits/stl_algo.h	2005-02-02 01:41:45.000000000 +0100
+++ libstdc++-v3/include/bits/stl_algo.h	2005-03-14 10:57:55.000000000 +0100
@@ -840,7 +840,10 @@
       __glibcxx_requires_valid_range(__first, __last);
 
       for ( ; __first != __last; ++__first, ++__result)
-	*__result = *__first == __old_value ? __new_value : *__first;
+	if (*__first == __old_value)
+	  *__result = __new_value;
+	else
+	  *__result = *__first;
       return __result;
     }
 
@@ -874,7 +877,10 @@
       __glibcxx_requires_valid_range(__first, __last);
 
       for ( ; __first != __last; ++__first, ++__result)
-	*__result = __pred(*__first) ? __new_value : *__first;
+	if (__pred(*__first))
+	  *__result = __new_value;
+	else
+	  *__result = *__first;
       return __result;
     }
 
diff -urN libstdc++-v3-orig/include/bits/stl_algobase.h libstdc++-v3/include/bits/stl_algobase.h
--- libstdc++-v3-orig/include/bits/stl_algobase.h	2005-02-27 13:14:08.000000000 +0100
+++ libstdc++-v3/include/bits/stl_algobase.h	2005-03-10 12:04:13.000000000 +0100
@@ -167,6 +167,7 @@
    *  @brief This does what you think it does.
    *  @param  a  A thing of arbitrary type.
    *  @param  b  Another thing of arbitrary type.
+   *  @param  comp  A @link s20_3_3_comparisons comparison functor@endlink.
    *  @return   The lesser of the parameters.
    *
    *  This will work on temporary expressions, since they are only evaluated
diff -urN libstdc++-v3-orig/testsuite/25_algorithms/count/1.cc libstdc++-v3/testsuite/25_algorithms/count/1.cc
--- libstdc++-v3-orig/testsuite/25_algorithms/count/1.cc	1970-01-01 01:00:00.000000000 +0100
+++ libstdc++-v3/testsuite/25_algorithms/count/1.cc	2005-03-10 12:04:13.000000000 +0100
@@ -0,0 +1,58 @@
+// Copyright (C) 2005 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 25.1.6 count
+
+#include <algorithm>
+#include <testsuite_hooks.h>
+#include <testsuite_iterators.h>
+
+using __gnu_test::test_container;
+using __gnu_test::input_iterator_wrapper;
+
+typedef test_container<int, input_iterator_wrapper> Container;
+int array[] = {0, 0, 0, 1, 0, 1};
+
+void
+test1()
+{
+  Container con(array, array);
+  VERIFY(std::count(con.begin(), con.end(), 1) == 0);
+}
+
+void
+test2()
+{
+  Container con(array, array + 1);
+  VERIFY(std::count(con.begin(), con.end(), 1) == 0);
+}
+
+void
+test3()
+{
+  Container con(array, array + 6);
+  VERIFY(std::count(con.begin(), con.end(), 1) == 2);
+}
+
+int 
+main()
+{
+  test1();
+  test2();
+  test3();
+}
diff -urN libstdc++-v3-orig/testsuite/25_algorithms/count/check_type.cc libstdc++-v3/testsuite/25_algorithms/count/check_type.cc
--- libstdc++-v3-orig/testsuite/25_algorithms/count/check_type.cc	1970-01-01 01:00:00.000000000 +0100
+++ libstdc++-v3/testsuite/25_algorithms/count/check_type.cc	2005-03-10 12:04:13.000000000 +0100
@@ -0,0 +1,42 @@
+// Copyright (C) 2005 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 25.1.2 find_if
+
+// { dg-do compile }
+
+#include <algorithm>
+#include <testsuite_iterators.h>
+
+struct X { };
+
+struct Y { };
+
+using __gnu_test::input_iterator_wrapper;
+
+bool
+operator==(const X&, const Y&)
+{ return true; }
+
+typedef std::iterator_traits<input_iterator_wrapper<X> >::difference_type
+	diff_type;
+
+diff_type
+test1(input_iterator_wrapper<X>& begin,
+      input_iterator_wrapper<X>& end)
+{ return std::count(begin, end, Y()); }
diff -urN libstdc++-v3-orig/testsuite/25_algorithms/count_if/1.cc libstdc++-v3/testsuite/25_algorithms/count_if/1.cc
--- libstdc++-v3-orig/testsuite/25_algorithms/count_if/1.cc	1970-01-01 01:00:00.000000000 +0100
+++ libstdc++-v3/testsuite/25_algorithms/count_if/1.cc	2005-03-10 12:04:13.000000000 +0100
@@ -0,0 +1,65 @@
+// Copyright (C) 2005 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 25.1.6 count_if
+
+#include <algorithm>
+#include <testsuite_hooks.h>
+#include <testsuite_iterators.h>
+
+using __gnu_test::test_container;
+using __gnu_test::input_iterator_wrapper;
+
+typedef test_container<int, input_iterator_wrapper> Container;
+int array[] = {0, 0, 0, 1, 0, 1};
+
+bool
+predicate(const int& i) 
+{ return i == 1; }
+
+void
+test1()
+{
+  Container con(array, array);
+  VERIFY(std::count_if(con.begin(), con.end(), 
+		       predicate) == 0);
+}
+
+void
+test2()
+{
+  Container con(array, array + 1);
+  VERIFY(std::count_if(con.begin(), con.end(), 
+		       predicate) == 0);
+}
+
+void
+test3()
+{
+  Container con(array, array + 6);
+  VERIFY(std::count_if(con.begin(), con.end(),
+		       predicate) == 2);
+}
+
+int 
+main()
+{
+  test1();
+  test2();
+  test3();
+}
diff -urN libstdc++-v3-orig/testsuite/25_algorithms/count_if/check_type.cc libstdc++-v3/testsuite/25_algorithms/count_if/check_type.cc
--- libstdc++-v3-orig/testsuite/25_algorithms/count_if/check_type.cc	1970-01-01 01:00:00.000000000 +0100
+++ libstdc++-v3/testsuite/25_algorithms/count_if/check_type.cc	2005-03-10 12:04:13.000000000 +0100
@@ -0,0 +1,52 @@
+// Copyright (C) 2005 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 25.1.2 find_if
+
+// { dg-do compile }
+
+#include <algorithm>
+#include <testsuite_iterators.h>
+
+struct X { };
+
+using __gnu_test::input_iterator_wrapper;
+
+bool
+pred_function(const X&)
+{ return true; }
+
+struct pred_obj
+{
+  bool 
+  operator()(const X&)
+  { return true; }
+};
+
+typedef std::iterator_traits<input_iterator_wrapper<X> >::difference_type
+	diff_type;
+
+diff_type
+test1(input_iterator_wrapper<X>& begin,
+      input_iterator_wrapper<X>& end)
+{ return std::count_if(begin, end, pred_function); }
+
+diff_type
+test2(input_iterator_wrapper<X>& begin,
+      input_iterator_wrapper<X>& end)
+{ return std::count_if(begin, end, pred_obj()); }
diff -urN libstdc++-v3-orig/testsuite/25_algorithms/find/1.cc libstdc++-v3/testsuite/25_algorithms/find/1.cc
--- libstdc++-v3-orig/testsuite/25_algorithms/find/1.cc	1970-01-01 01:00:00.000000000 +0100
+++ libstdc++-v3/testsuite/25_algorithms/find/1.cc	2005-03-10 12:04:13.000000000 +0100
@@ -0,0 +1,58 @@
+// Copyright (C) 2005 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 25.1.2 find
+
+#include <algorithm>
+#include <testsuite_hooks.h>
+#include <testsuite_iterators.h>
+
+using __gnu_test::test_container;
+using __gnu_test::input_iterator_wrapper;
+
+typedef test_container<int, input_iterator_wrapper> Container;
+int array[] = {0, 0, 0, 1, 0, 1};
+
+void
+test1()
+{
+  Container con(array, array);
+  VERIFY(std::find(con.begin(), con.end(), 1).ptr == array);
+}
+
+void
+test2()
+{
+  Container con(array, array + 1);
+  VERIFY(std::find(con.begin(), con.end(), 1).ptr == array + 1);
+}
+
+void
+test3()
+{
+  Container con(array, array + 6);
+  VERIFY(std::find(con.begin(), con.end(), 1).ptr == array + 3);
+}
+
+int 
+main()
+{
+  test1();
+  test2();
+  test3();
+}
diff -urN libstdc++-v3-orig/testsuite/25_algorithms/find/check_type.cc libstdc++-v3/testsuite/25_algorithms/find/check_type.cc
--- libstdc++-v3-orig/testsuite/25_algorithms/find/check_type.cc	1970-01-01 01:00:00.000000000 +0100
+++ libstdc++-v3/testsuite/25_algorithms/find/check_type.cc	2005-03-10 12:04:13.000000000 +0100
@@ -0,0 +1,38 @@
+// Copyright (C) 2005 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 25.1.2 find
+
+// { dg-do compile }
+
+#include <algorithm>
+#include <testsuite_iterators.h>
+
+using __gnu_test::input_iterator_wrapper;
+
+struct Lhs { };
+struct Rhs { };
+
+bool
+operator==(const Lhs&, const Rhs&)
+{ return true; }
+
+input_iterator_wrapper<Lhs>
+test1(input_iterator_wrapper<Lhs>& begin,
+      input_iterator_wrapper<Lhs>& end, Rhs& val)
+{ return std::find(begin, end, val); }
diff -urN libstdc++-v3-orig/testsuite/25_algorithms/find_if/1.cc libstdc++-v3/testsuite/25_algorithms/find_if/1.cc
--- libstdc++-v3-orig/testsuite/25_algorithms/find_if/1.cc	1970-01-01 01:00:00.000000000 +0100
+++ libstdc++-v3/testsuite/25_algorithms/find_if/1.cc	2005-03-10 12:04:13.000000000 +0100
@@ -0,0 +1,65 @@
+// Copyright (C) 2005 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 25.1.2 find_if
+
+#include <algorithm>
+#include <testsuite_hooks.h>
+#include <testsuite_iterators.h>
+
+using __gnu_test::test_container;
+using __gnu_test::input_iterator_wrapper;
+
+typedef test_container<int, input_iterator_wrapper> Container;
+int array[] = {0, 0, 0, 1, 0, 1};
+
+bool
+predicate(const int& i) 
+{ return i == 1; }
+
+void
+test1()
+{
+  Container con(array, array);
+  VERIFY(std::find_if(con.begin(), con.end(), 
+		      predicate).ptr == array);
+}
+
+void
+test2()
+{
+  Container con(array, array + 1);
+  VERIFY(std::find_if(con.begin(), con.end(), 
+		      predicate).ptr == array + 1);
+}
+
+void
+test3()
+{
+  Container con(array, array + 6);
+  VERIFY(std::find_if(con.begin(), con.end(),
+		      predicate).ptr == array + 3);
+}
+
+int 
+main()
+{
+  test1();
+  test2();
+  test3();
+}
diff -urN libstdc++-v3-orig/testsuite/25_algorithms/find_if/check_type.cc libstdc++-v3/testsuite/25_algorithms/find_if/check_type.cc
--- libstdc++-v3-orig/testsuite/25_algorithms/find_if/check_type.cc	1970-01-01 01:00:00.000000000 +0100
+++ libstdc++-v3/testsuite/25_algorithms/find_if/check_type.cc	2005-03-10 12:04:13.000000000 +0100
@@ -0,0 +1,49 @@
+// Copyright (C) 2005 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 25.1.2 find_if
+
+// { dg-do compile }
+
+#include <algorithm>
+#include <testsuite_iterators.h>
+
+struct X { };
+
+using __gnu_test::input_iterator_wrapper;
+
+bool
+pred_function(const X&)
+{ return true; }
+
+struct pred_obj
+{
+  bool 
+  operator()(const X&)
+  { return true; }
+};
+
+input_iterator_wrapper<X>
+test1(input_iterator_wrapper<X>& begin,
+      input_iterator_wrapper<X>& end)
+{ return std::find_if(begin, end, pred_function); }
+
+input_iterator_wrapper<X>
+test2(input_iterator_wrapper<X>& begin,
+      input_iterator_wrapper<X>& end)
+{ return std::find_if(begin, end, pred_obj()); }
diff -urN libstdc++-v3-orig/testsuite/25_algorithms/remove/1.cc libstdc++-v3/testsuite/25_algorithms/remove/1.cc
--- libstdc++-v3-orig/testsuite/25_algorithms/remove/1.cc	1970-01-01 01:00:00.000000000 +0100
+++ libstdc++-v3/testsuite/25_algorithms/remove/1.cc	2005-03-10 12:04:13.000000000 +0100
@@ -0,0 +1,63 @@
+// Copyright (C) 2005 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 25.2.4 remove
+
+#include <algorithm>
+#include <testsuite_hooks.h>
+#include <testsuite_iterators.h>
+
+using __gnu_test::test_container;
+using __gnu_test::forward_iterator_wrapper;
+
+typedef test_container<int, forward_iterator_wrapper> Container; 
+
+void
+test1()
+{
+  int array[1];
+  Container con(array, array);
+  VERIFY(std::remove(con.begin(), con.end(), 1).ptr == array);
+}
+
+void
+test2()
+{
+  int array[] = {1};
+  Container con(array, array + 1);
+  VERIFY(std::remove(con.begin(), con.end(), 0).ptr == array + 1);
+  VERIFY(std::remove(con.begin(), con.end(), 1).ptr == array);
+}
+
+void
+test3()
+{
+  int array[] = {0, 1, 0, 1, 0, 0, 1, 1};
+  Container con(array, array + 8);
+  VERIFY(std::remove(con.begin(), con.end(), 1).ptr == array + 4);
+  VERIFY(array[0] == 0 && array[1] == 0 && array[2] == 0 && 
+	 array[3] == 0);
+}
+
+int
+main()
+{
+  test1();
+  test2();
+  test3();
+}
diff -urN libstdc++-v3-orig/testsuite/25_algorithms/remove/check_type.cc libstdc++-v3/testsuite/25_algorithms/remove/check_type.cc
--- libstdc++-v3-orig/testsuite/25_algorithms/remove/check_type.cc	1970-01-01 01:00:00.000000000 +0100
+++ libstdc++-v3/testsuite/25_algorithms/remove/check_type.cc	2005-03-10 12:04:13.000000000 +0100
@@ -0,0 +1,39 @@
+// Copyright (C) 2005 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 25.2.7 Remove
+
+// { dg-do compile }
+
+#include <algorithm>
+#include <testsuite_iterators.h>
+
+using __gnu_test::forward_iterator_wrapper;
+
+struct X { };
+
+struct Y { };
+
+bool
+operator==(const X&, const Y&)
+{ return true; }
+
+forward_iterator_wrapper<X>
+test1(forward_iterator_wrapper<X>& begin,
+      forward_iterator_wrapper<X>& end, const Y& val)
+{ return std::remove(begin, end, val); }
diff -urN libstdc++-v3-orig/testsuite/25_algorithms/remove_if/1.cc libstdc++-v3/testsuite/25_algorithms/remove_if/1.cc
--- libstdc++-v3-orig/testsuite/25_algorithms/remove_if/1.cc	1970-01-01 01:00:00.000000000 +0100
+++ libstdc++-v3/testsuite/25_algorithms/remove_if/1.cc	2005-03-10 12:04:13.000000000 +0100
@@ -0,0 +1,63 @@
+// Copyright (C) 2005 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 25.2.4 remove
+
+#include <algorithm>
+#include <testsuite_hooks.h>
+#include <testsuite_iterators.h>
+
+using __gnu_test::test_container;
+using __gnu_test::forward_iterator_wrapper;
+
+typedef test_container<int, forward_iterator_wrapper> Container; 
+
+void
+test1()
+{
+  int array[1];
+  Container con(array, array);
+  VERIFY(std::remove(con.begin(), con.end(), 1).ptr == array);
+}
+
+void
+test2()
+{
+  int array[] = {1};
+  Container con(array, array + 1);
+  VERIFY(std::remove(con.begin(), con.end(), 0).ptr == array + 1);
+  VERIFY(std::remove(con.begin(), con.end(), 1).ptr == array);
+}
+
+void
+test3()
+{
+  int array[] = {0, 1, 0, 1, 0, 0, 1, 1};
+  Container con(array, array + 8);
+  VERIFY(std::remove(con.begin(), con.end(), 1).ptr == array + 4);
+  VERIFY(array[0] == 0 && array[1] == 0 && array[2] == 0 &&
+         array[3] == 0);
+}
+
+int
+main()
+{
+  test1();
+  test2();
+  test3();
+}
diff -urN libstdc++-v3-orig/testsuite/25_algorithms/remove_if/check_type.cc libstdc++-v3/testsuite/25_algorithms/remove_if/check_type.cc
--- libstdc++-v3-orig/testsuite/25_algorithms/remove_if/check_type.cc	1970-01-01 01:00:00.000000000 +0100
+++ libstdc++-v3/testsuite/25_algorithms/remove_if/check_type.cc	2005-03-10 12:04:13.000000000 +0100
@@ -0,0 +1,50 @@
+// Copyright (C) 2005 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 25.2.7 Remove_if
+
+// { dg-do compile }
+
+#include <algorithm>
+#include <testsuite_iterators.h>
+
+using __gnu_test::forward_iterator_wrapper;
+
+struct X { };
+
+bool
+pred_fn(const X&)
+{ return true; }
+
+struct pred_obj
+{
+  bool
+  operator()(const X&) const
+  { return true; }
+};
+
+forward_iterator_wrapper<X>
+test1(forward_iterator_wrapper<X>& begin,
+      forward_iterator_wrapper<X>& end)
+{ return std::remove_if(begin, end, pred_fn); }
+
+forward_iterator_wrapper<X>
+test2(forward_iterator_wrapper<X>& begin,
+      forward_iterator_wrapper<X>& end)
+{ return std::remove_if(begin, end, pred_obj()); }
+
diff -urN libstdc++-v3-orig/testsuite/25_algorithms/replace/1.cc libstdc++-v3/testsuite/25_algorithms/replace/1.cc
--- libstdc++-v3-orig/testsuite/25_algorithms/replace/1.cc	1970-01-01 01:00:00.000000000 +0100
+++ libstdc++-v3/testsuite/25_algorithms/replace/1.cc	2005-03-10 12:04:13.000000000 +0100
@@ -0,0 +1,61 @@
+// Copyright (C) 2005 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 25.2.4 replace
+
+#include <algorithm>
+#include <testsuite_hooks.h>
+#include <testsuite_iterators.h>
+
+using __gnu_test::test_container;
+using __gnu_test::forward_iterator_wrapper;
+
+typedef test_container<int, forward_iterator_wrapper> Container; 
+int array[] = {0, 0, 0, 1, 0, 1};
+
+void
+test1()
+{
+  Container con(array, array);
+  std::replace(con.begin(), con.end(), 1, 1);
+}
+
+void
+test2()
+{
+  Container con(array, array + 1);
+  std::replace(con.begin(), con.end(), 0, 1);
+  VERIFY(array[0] == 1);
+}
+
+void
+test3()
+{
+  Container con(array, array + 6);
+  std::replace(con.begin(), con.end(), 1, 2);
+  VERIFY(array[0] == 2 && array[1] == 0 && array[2] == 0 &&
+         array[3] == 2 && array[4] == 0 && array[5] == 2);
+}
+
+int 
+main()
+{
+  test1();
+  test2();
+  test3();
+}
diff -urN libstdc++-v3-orig/testsuite/25_algorithms/replace/check_type.cc libstdc++-v3/testsuite/25_algorithms/replace/check_type.cc
--- libstdc++-v3-orig/testsuite/25_algorithms/replace/check_type.cc	1970-01-01 01:00:00.000000000 +0100
+++ libstdc++-v3/testsuite/25_algorithms/replace/check_type.cc	2005-03-10 12:04:13.000000000 +0100
@@ -0,0 +1,38 @@
+// Copyright (C) 2005 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 25.2.4 Replace
+
+// { dg-do compile }
+
+#include <algorithm>
+#include <testsuite_iterators.h>
+
+using __gnu_test::forward_iterator_wrapper;
+
+struct X { };
+
+bool
+operator==(const X&, const X&)
+{ return true; }
+
+void
+test1(forward_iterator_wrapper<X>& begin,
+      forward_iterator_wrapper<X>& end, const X& old_val,
+      const X& new_val)
+{ return std::replace(begin, end, old_val, new_val); }
diff -urN libstdc++-v3-orig/testsuite/25_algorithms/replace_copy/1.cc libstdc++-v3/testsuite/25_algorithms/replace_copy/1.cc
--- libstdc++-v3-orig/testsuite/25_algorithms/replace_copy/1.cc	1970-01-01 01:00:00.000000000 +0100
+++ libstdc++-v3/testsuite/25_algorithms/replace_copy/1.cc	2005-03-10 12:04:13.000000000 +0100
@@ -0,0 +1,72 @@
+// Copyright (C) 2005 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 25.2.4 replace_copy
+
+#include <algorithm>
+#include <testsuite_hooks.h>
+#include <testsuite_iterators.h>
+
+using __gnu_test::test_container;
+using __gnu_test::input_iterator_wrapper;
+using __gnu_test::output_iterator_wrapper;
+
+typedef test_container<int, input_iterator_wrapper> Icontainer; 
+typedef test_container<int, output_iterator_wrapper> Ocontainer;
+int array[] = {0, 0, 0, 1, 0, 1};
+
+void
+test1()
+{
+  int out[1];
+  Icontainer in_con(array, array);
+  Ocontainer out_con(out, out);
+  VERIFY(std::replace_copy(in_con.begin(), in_con.end(), 
+	                   out_con.begin(), 1, 1).ptr == out);
+}
+
+void
+test2()
+{
+  int out[1];
+  Icontainer in_con(array, array + 1);
+  Ocontainer out_con(out, out + 1);
+  VERIFY(std::replace_copy(in_con.begin(), in_con.end(), 
+			   out_con.begin(), 0, 1).ptr == out + 1);
+  VERIFY(out[0] == 1);
+}
+
+void
+test3()
+{
+  int out[6];
+  Icontainer in_con(array, array + 6);
+  Ocontainer out_con(out, out + 6);
+  VERIFY(std::replace_copy(in_con.begin(), in_con.end(),
+			   out_con.begin(), 1, 2).ptr == out + 6);
+  VERIFY(out[0] == 0 && out[1] == 0 && out[2] == 0 &&
+         out[3] == 2 && out[4] == 0 && out[5] == 2);
+}
+
+int 
+main()
+{
+  test1();
+  test2();
+  test3();
+}
diff -urN libstdc++-v3-orig/testsuite/25_algorithms/replace_copy/check_type.cc libstdc++-v3/testsuite/25_algorithms/replace_copy/check_type.cc
--- libstdc++-v3-orig/testsuite/25_algorithms/replace_copy/check_type.cc	1970-01-01 01:00:00.000000000 +0100
+++ libstdc++-v3/testsuite/25_algorithms/replace_copy/check_type.cc	2005-03-10 12:04:13.000000000 +0100
@@ -0,0 +1,56 @@
+// Copyright (C) 2005 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 25.2.4 replace_copy
+
+// { dg-do compile }
+
+#include <algorithm>
+#include <testsuite_iterators.h>
+
+using __gnu_test::input_iterator_wrapper;
+using __gnu_test::output_iterator_wrapper;
+
+struct X { };
+
+struct Y { };
+
+struct Z
+{
+  Z&
+  operator=(const X&)
+  { }
+
+  Z&
+  operator=(const Y&)
+  { }
+};
+
+bool
+operator==(const X&, const Y&)
+{ return true; }
+
+output_iterator_wrapper<Z>
+test1(input_iterator_wrapper<X>& begin,
+      input_iterator_wrapper<X>& end,
+      output_iterator_wrapper<Z>& output,
+      const Y& old_val, const Y& new_val)
+{ 
+  return std::replace_copy(begin, end, output, old_val, 
+			   new_val); 
+}
diff -urN libstdc++-v3-orig/testsuite/25_algorithms/replace_copy_if/1.cc libstdc++-v3/testsuite/25_algorithms/replace_copy_if/1.cc
--- libstdc++-v3-orig/testsuite/25_algorithms/replace_copy_if/1.cc	1970-01-01 01:00:00.000000000 +0100
+++ libstdc++-v3/testsuite/25_algorithms/replace_copy_if/1.cc	2005-03-10 12:04:13.000000000 +0100
@@ -0,0 +1,76 @@
+// Copyright (C) 2005 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 25.2.4 replace_copy_if
+
+#include <algorithm>
+#include <testsuite_hooks.h>
+#include <testsuite_iterators.h>
+
+using __gnu_test::test_container;
+using __gnu_test::input_iterator_wrapper;
+using __gnu_test::output_iterator_wrapper;
+
+typedef test_container<int, input_iterator_wrapper> Icontainer; 
+typedef test_container<int, output_iterator_wrapper> Ocontainer;
+int array[] = {0, 0, 0, 1, 0, 1};
+
+bool
+pred(int i)
+{ return i == 1; }
+
+void
+test1()
+{
+  int out[1];
+  Icontainer in_con(array, array);
+  Ocontainer out_con(out, out);
+  VERIFY(std::replace_copy_if(in_con.begin(), in_con.end(), 
+	                      out_con.begin(), pred, 1).ptr == out);
+}
+
+void
+test2()
+{
+  int out[1];
+  Icontainer in_con(array, array + 1);
+  Ocontainer out_con(out, out + 1);
+  VERIFY(std::replace_copy_if(in_con.begin(), in_con.end(), 
+			      out_con.begin(), pred, 2).ptr == out + 1);
+  VERIFY(out[0] == 0);
+}
+
+void
+test3()
+{
+  int out[6];
+  Icontainer in_con(array, array + 6);
+  Ocontainer out_con(out, out + 6);
+  VERIFY(std::replace_copy_if(in_con.begin(), in_con.end(),
+			      out_con.begin(), pred, 2).ptr == out + 6);
+  VERIFY(out[0] == 0 && out[1] == 0 && out[2] == 0 &&
+         out[3] == 2 && out[4] == 0 && out[5] == 2);
+}
+
+int 
+main()
+{
+  test1();
+  test2();
+  test3();
+}
diff -urN libstdc++-v3-orig/testsuite/25_algorithms/replace_copy_if/check_type.cc libstdc++-v3/testsuite/25_algorithms/replace_copy_if/check_type.cc
--- libstdc++-v3-orig/testsuite/25_algorithms/replace_copy_if/check_type.cc	1970-01-01 01:00:00.000000000 +0100
+++ libstdc++-v3/testsuite/25_algorithms/replace_copy_if/check_type.cc	2005-03-14 11:06:35.000000000 +0100
@@ -0,0 +1,56 @@
+// Copyright (C) 2005 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 25.2.4 replace_copy_if
+
+// { dg-do compile }
+
+#include <algorithm>
+#include <testsuite_iterators.h>
+
+using __gnu_test::input_iterator_wrapper;
+using __gnu_test::output_iterator_wrapper;
+
+struct X { };
+
+struct Y { };
+
+struct Z
+{
+  Z&
+  operator=(const X&)
+  { }
+
+  Z&
+  operator=(const Y&)
+  { }
+};
+
+bool
+predicate(const X&)
+{ return true; }
+
+output_iterator_wrapper<Z>
+test1(input_iterator_wrapper<X>& begin,
+      input_iterator_wrapper<X>& end,
+      output_iterator_wrapper<Z>& output,
+      const Y& new_val)
+{ 
+  return std::replace_copy_if(begin, end, output, predicate, 
+			      new_val); 
+}
diff -urN libstdc++-v3-orig/testsuite/25_algorithms/replace_copy_if/check_type.cc~ libstdc++-v3/testsuite/25_algorithms/replace_copy_if/check_type.cc~
--- libstdc++-v3-orig/testsuite/25_algorithms/replace_copy_if/check_type.cc~	1970-01-01 01:00:00.000000000 +0100
+++ libstdc++-v3/testsuite/25_algorithms/replace_copy_if/check_type.cc~	2005-03-10 12:04:13.000000000 +0100
@@ -0,0 +1,52 @@
+// Copyright (C) 2005 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 25.2.4 replace_copy_if
+
+// { dg-do compile }
+
+#include <algorithm>
+#include <testsuite_iterators.h>
+
+using __gnu_test::input_iterator_wrapper;
+using __gnu_test::output_iterator_wrapper;
+
+struct X { };
+
+struct Y { };
+
+struct Z
+{
+  Z(const X&) { }
+  Z(const Y&) { }
+};
+
+bool
+predicate(const X&)
+{ return true; }
+
+
+output_iterator_wrapper<X>
+test1(input_iterator_wrapper<X>& begin,
+      input_iterator_wrapper<X>& end,
+      output_iterator_wrapper<X>& output,
+      const X& new_val)
+{ 
+  return std::replace_copy_if(begin, end, output, predicate, 
+			      new_val); 
+}
diff -urN libstdc++-v3-orig/testsuite/25_algorithms/replace_if/1.cc libstdc++-v3/testsuite/25_algorithms/replace_if/1.cc
--- libstdc++-v3-orig/testsuite/25_algorithms/replace_if/1.cc	1970-01-01 01:00:00.000000000 +0100
+++ libstdc++-v3/testsuite/25_algorithms/replace_if/1.cc	2005-03-10 12:04:13.000000000 +0100
@@ -0,0 +1,65 @@
+// Copyright (C) 2005 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 25.2.4 replace_if
+
+#include <algorithm>
+#include <testsuite_hooks.h>
+#include <testsuite_iterators.h>
+
+using __gnu_test::test_container;
+using __gnu_test::forward_iterator_wrapper;
+
+typedef test_container<int, forward_iterator_wrapper> Container; 
+int array[] = {1, 0, 0, 1, 0, 1};
+
+bool
+predicate(const int& i)
+{ return i == 1; }
+
+void
+test1()
+{
+  Container con(array, array);
+  std::replace_if(con.begin(), con.end(), predicate, 1);
+}
+
+void
+test2()
+{
+  Container con(array, array + 1);
+  std::replace_if(con.begin(), con.end(), predicate, 2);
+  VERIFY(array[0] == 2);
+}
+
+void
+test3()
+{
+  Container con(array, array + 6);
+  std::replace_if(con.begin(), con.end(), predicate, 3);
+  VERIFY(array[0] == 2 && array[1] == 0 && array[2] == 0 &&
+         array[3] == 3 && array[4] == 0 && array[5] == 3);
+}
+
+int 
+main()
+{
+  test1();
+  test2();
+  test3();
+}
diff -urN libstdc++-v3-orig/testsuite/25_algorithms/replace_if/check_type.cc libstdc++-v3/testsuite/25_algorithms/replace_if/check_type.cc
--- libstdc++-v3-orig/testsuite/25_algorithms/replace_if/check_type.cc	1970-01-01 01:00:00.000000000 +0100
+++ libstdc++-v3/testsuite/25_algorithms/replace_if/check_type.cc	2005-03-10 12:04:13.000000000 +0100
@@ -0,0 +1,52 @@
+// Copyright (C) 2005 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 25.2.4 replace_if
+
+// { dg-do compile }
+
+#include <algorithm>
+#include <testsuite_iterators.h>
+
+using __gnu_test::forward_iterator_wrapper;
+
+struct X { };
+
+bool
+pred_fn(const X&)
+{ return true; }
+
+struct pred_obj
+{
+  bool
+  operator()(const X&)
+  { return true; }
+};
+
+
+void
+test1(forward_iterator_wrapper<X>& begin,
+      forward_iterator_wrapper<X>& end, const X& new_val)
+{ return std::replace_if(begin, end, pred_fn, new_val); }
+
+void
+test2(forward_iterator_wrapper<X>& begin,
+      forward_iterator_wrapper<X>& end, const X& new_val)
+{ return std::replace_if(begin, end, pred_obj(), new_val); }
+
+
diff -urN libstdc++-v3-orig/testsuite/testsuite_iterators.h libstdc++-v3/testsuite/testsuite_iterators.h
--- libstdc++-v3-orig/testsuite/testsuite_iterators.h	2005-02-01 11:59:55.000000000 +0100
+++ libstdc++-v3/testsuite/testsuite_iterators.h	2005-03-10 12:04:13.000000000 +0100
@@ -98,7 +98,7 @@
 
       template<class U>
       void
-      operator=(U& new_val)
+      operator=(const U& new_val)
       {
 	ITERATOR_VERIFY(SharedInfo->writtento[ptr - SharedInfo->first] == 0);
 	SharedInfo->writtento[ptr - SharedInfo->first] = 1;

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]