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]

[Patch] Port from v7 fix for 17441


Hi,

another minor, safe, tweak. Tested x86-linux.

Paolo.

P.S. Note that std::find is not present in the binary library, not even
as a local symbol (because the version of std::search(,,BinaryPredicate)
currently in mainline - which we *are* instantiating for basic_string -
doesn't use at all std::find/std::find_if)

////////////
2005-06-30  Paolo Carlini  <pcarlini@suse.de>

        Port from libstdcxx_so_7-branch:
	2004-10-28  Chris Jefferson  <chris@bubblescope.net>

	PR libstdc++/17441
	* include/bit/stl_algo.h (find(,,,input_iterator_tag),
	find(,,,random_access_interator_tag),
	find_if(,,,input_iterator_tag),
	find_if(,,,random_access_iterator_tag)): Uglify function name.
	(find, find_if): Use new uglified specialisation names.
	* testsuite/25_algorithms/find/17441.cc: New.
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-05-25 00:53:06.000000000 +0200
+++ libstdc++-v3/include/bits/stl_algo.h	2005-06-30 17:24:37.000000000 +0200
@@ -166,8 +166,8 @@
   */
   template<typename _InputIterator, typename _Tp>
     inline _InputIterator
-    find(_InputIterator __first, _InputIterator __last,
-	 const _Tp& __val, input_iterator_tag)
+    __find(_InputIterator __first, _InputIterator __last,
+	   const _Tp& __val, input_iterator_tag)
     {
       while (__first != __last && !(*__first == __val))
 	++__first;
@@ -181,8 +181,8 @@
   */
   template<typename _InputIterator, typename _Predicate>
     inline _InputIterator
-    find_if(_InputIterator __first, _InputIterator __last,
-	    _Predicate __pred, input_iterator_tag)
+    __find_if(_InputIterator __first, _InputIterator __last,
+	      _Predicate __pred, input_iterator_tag)
     {
       while (__first != __last && !__pred(*__first))
 	++__first;
@@ -196,8 +196,8 @@
   */
   template<typename _RandomAccessIterator, typename _Tp>
     _RandomAccessIterator
-    find(_RandomAccessIterator __first, _RandomAccessIterator __last,
-	 const _Tp& __val, random_access_iterator_tag)
+    __find(_RandomAccessIterator __first, _RandomAccessIterator __last,
+	   const _Tp& __val, random_access_iterator_tag)
     {
       typename iterator_traits<_RandomAccessIterator>::difference_type
 	__trip_count = (__last - __first) >> 2;
@@ -248,8 +248,8 @@
   */
   template<typename _RandomAccessIterator, typename _Predicate>
     _RandomAccessIterator
-    find_if(_RandomAccessIterator __first, _RandomAccessIterator __last,
-	    _Predicate __pred, random_access_iterator_tag)
+    __find_if(_RandomAccessIterator __first, _RandomAccessIterator __last,
+	      _Predicate __pred, random_access_iterator_tag)
     {
       typename iterator_traits<_RandomAccessIterator>::difference_type
 	__trip_count = (__last - __first) >> 2;
@@ -311,8 +311,8 @@
       __glibcxx_function_requires(_EqualOpConcept<
 		typename iterator_traits<_InputIterator>::value_type, _Tp>)
       __glibcxx_requires_valid_range(__first, __last);
-      return std::find(__first, __last, __val,
-		       std::__iterator_category(__first));
+      return std::__find(__first, __last, __val,
+		         std::__iterator_category(__first));
     }
 
   /**
@@ -333,8 +333,8 @@
       __glibcxx_function_requires(_UnaryPredicateConcept<_Predicate,
 	      typename iterator_traits<_InputIterator>::value_type>)
       __glibcxx_requires_valid_range(__first, __last);
-      return std::find_if(__first, __last, __pred,
-			  std::__iterator_category(__first));
+      return std::__find_if(__first, __last, __pred,
+			    std::__iterator_category(__first));
     }
 
   /**
diff -urN libstdc++-v3-orig/testsuite/25_algorithms/find/17441.cc libstdc++-v3/testsuite/25_algorithms/find/17441.cc
--- libstdc++-v3-orig/testsuite/25_algorithms/find/17441.cc	1970-01-01 01:00:00.000000000 +0100
+++ libstdc++-v3/testsuite/25_algorithms/find/17441.cc	2005-06-30 17:23:15.000000000 +0200
@@ -0,0 +1,43 @@
+// Copyright (C) 2004, 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.3.1 algorithms, find()
+
+#include <algorithm>
+
+using namespace std;
+
+template<typename InputIterator, typename Tp>
+  InputIterator
+  find(InputIterator first, InputIterator last,
+       const Tp& val, input_iterator_tag)
+  { return first; }
+
+// libstdc++/17441
+void test01()
+{
+  input_iterator_tag a;
+  int i;
+  find(&i, &i, 1, a);
+}
+
+int main()
+{
+  test01();
+  return 0;
+}

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