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] | |
Just what it says, a very simple patch to allow __moving const references. Mainly to allow standard algorithms to apply to proxy iterators (in particular vector<bool>) tested on powerpc-darwin.
Attachment:
changelog-move
Description: application/text
diff -urNx '*CVS*' libstdc++-v3.diff/include/bits/moveable.h libstdc++-v3/include/bits/moveable.h
--- libstdc++-v3.diff/include/bits/moveable.h 2005-08-12 11:21:52.000000000 +0100
+++ libstdc++-v3/include/bits/moveable.h 2005-09-10 00:02:01.000000000 +0100
@@ -74,6 +74,16 @@
__move(_Tp& __in)
{ return __move_helper<_Tp>::__move(__in); }
+ // We shouldn't need this overload of __move. It is needed in particular
+ // for forward (and better) iterators which don't return a non-const
+ // reference to the value they represent. The standard says there shouldn't
+ // be any such iterators. Then someone wrote vector<bool>, which breaks that
+ // rule.
+ template<class _Tp>
+ inline const _Tp&
+ __move(const _Tp& __in)
+ { return __in; }
+
} // namespace __gnu_cxx
#endif
diff -urNx '*CVS*' libstdc++-v3.diff/testsuite/25_algorithms/sort/sort-vectorbool.cc libstdc++-v3/testsuite/25_algorithms/sort/sort-vectorbool.cc
--- libstdc++-v3.diff/testsuite/25_algorithms/sort/sort-vectorbool.cc 1970-01-01 01:00:00.000000000 +0100
+++ libstdc++-v3/testsuite/25_algorithms/sort/sort-vectorbool.cc 2005-09-09 23:54:03.000000000 +0100
@@ -0,0 +1,45 @@
+// 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.3.1 algorithms, sort()
+
+#include <algorithm>
+#include <vector>
+#include <testsuite_hooks.h>
+
+bool test __attribute__((unused)) = true;
+
+void
+test01()
+{
+ std::vector<bool> b;
+ b.push_back(false);
+ b.push_back(true);
+ b.push_back(false);
+ b.push_back(true);
+ std::sort(b.begin(), b.end());
+ VERIFY(b[0] == false && b[1] == false && b[2] == true && b[3] == true);
+}
+
+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] |