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] | |
diff -urN -x '*CVS*' libstdc++-v3.so_7.clean/include/bits/stl_algo.h libstdc++-v3/include/bits/stl_algo.h
--- libstdc++-v3.so_7.clean/include/bits/stl_algo.h 2005-05-13 18:47:05.000000000 +0100
+++ libstdc++-v3/include/bits/stl_algo.h 2005-05-16 17:57:34.000000000 +0100
@@ -1035,10 +1035,17 @@
__glibcxx_requires_valid_range(__first, __last);
__first = std::find(__first, __last, __value);
- _ForwardIterator __i = __first;
- return __first == __last ? __first
- : std::remove_copy(++__i, __last,
- __first, __value);
+ if(__first == __last)
+ return __first;
+ _ForwardIterator __result = __first;
+ ++__first;
+ for( ; __first != __last; ++__first)
+ if(!(*__first == __value))
+ {
+ *__result = __gnu_cxx::__move(*__first);
+ ++__result;
+ }
+ return __result;
}
/**
@@ -1071,9 +1078,17 @@
__first = std::find_if(__first, __last, __pred);
_ForwardIterator __i = __first;
- return __first == __last ? __first
- : std::remove_copy_if(++__i, __last,
- __first, __pred);
+ if(__first == __last)
+ return __first;
+ _ForwardIterator __result = __first;
+ ++__first;
+ for( ; __first != __last; ++__first)
+ if(!__pred(*__first))
+ {
+ *__result = __gnu_cxx::__move(*__first);
+ ++__result;
+ }
+ return __result;
}
/**
@@ -1402,7 +1417,7 @@
_ForwardIterator __first2 = __middle;
do
{
- swap(*__first, *__first2);
+ std::iter_swap(__first, __first2);
++__first;
++__first2;
if (__first == __middle)
@@ -1414,7 +1429,7 @@
while (__first2 != __last)
{
- swap(*__first, *__first2);
+ std::iter_swap(__first, __first2);
++__first;
++__first2;
if (__first == __middle)
@@ -1448,7 +1463,7 @@
while (__first != __middle && __middle != __last)
{
- swap(*__first, *--__last);
+ std::iter_swap(__first, --__last);
++__first;
}
@@ -1496,7 +1511,7 @@
for (_Distance __i = 0; __i < __d; __i++)
{
- const _ValueType __tmp = *__first;
+ _ValueType __tmp(__gnu_cxx::__move(*__first));
_RandomAccessIterator __p = __first;
if (__k < __l)
@@ -1505,11 +1520,11 @@
{
if (__p > __first + __l)
{
- *__p = *(__p - __l);
+ *__p = __gnu_cxx::__move(*(__p - __l));
__p -= __l;
}
- *__p = *(__p + __k);
+ *__p = __gnu_cxx::__move(*(__p + __k));
__p += __k;
}
}
@@ -1519,15 +1534,15 @@
{
if (__p < __last - __k)
{
- *__p = *(__p + __k);
+ *__p = __gnu_cxx::__move(*(__p + __k));
__p += __k;
}
- *__p = * (__p - __l);
+ *__p = __gnu_cxx::__move(*(__p - __l));
__p -= __l;
}
}
- *__p = __tmp;
+ *__p = __gnu_cxx::__move(__tmp);
++__first;
}
}
@@ -1676,7 +1691,7 @@
while (++__next != __last)
if (__pred(*__next))
{
- swap(*__first, *__next);
+ std::iter_swap(__first, __next);
++__first;
}
@@ -2048,7 +2063,7 @@
std::make_heap(__first, __middle, __comp);
for (_RandomAccessIterator __i = __middle; __i < __last; ++__i)
if (__comp(*__i, *__first))
- std::__pop_heap(__first, __middle, __i, _ValueType(*__i), __comp);
+ std::__pop_heap(__first, __middle, __i, __comp);
std::sort_heap(__first, __middle, __comp);
}
diff -urN -x '*CVS*' libstdc++-v3.so_7.clean/include/bits/stl_heap.h libstdc++-v3/include/bits/stl_heap.h
--- libstdc++-v3.so_7.clean/include/bits/stl_heap.h 2005-03-09 00:47:37.000000000 +0000
+++ libstdc++-v3/include/bits/stl_heap.h 2005-05-16 09:51:47.000000000 +0100
@@ -103,7 +103,7 @@
// Heap-manipulation functions: push_heap, pop_heap, make_heap, sort_heap.
- template<typename _RandomAccessIterator, typename _Distance, typename _Tp,
+ template<typename _Tp, typename _RandomAccessIterator, typename _Distance,
typename _Compare>
void
__push_heap(_RandomAccessIterator __first, _Distance __holeIndex,
@@ -113,11 +113,11 @@
while (__holeIndex > __topIndex
&& __comp(*(__first + __parent), __value))
{
- *(__first + __holeIndex) = *(__first + __parent);
+ *(__first + __holeIndex) = __gnu_cxx::__move(*(__first + __parent));
__holeIndex = __parent;
__parent = (__holeIndex - 1) / 2;
}
- *(__first + __holeIndex) = __value;
+ *(__first + __holeIndex) = __gnu_cxx::__move(__value);
}
/**
@@ -147,8 +147,10 @@
__glibcxx_requires_valid_range(__first, __last);
__glibcxx_requires_heap_pred(__first, __last - 1, __comp);
- std::__push_heap(__first, _DistanceType((__last - __first) - 1),
- _DistanceType(0), _ValueType(*(__last - 1)), __comp);
+ std::__push_heap<_ValueType>(__first,
+ _DistanceType((__last - __first) - 1),
+ _DistanceType(0),
+ __gnu_cxx::__move(*(__last - 1)), __comp);
}
/**
@@ -175,13 +177,15 @@
__glibcxx_function_requires(_LessThanComparableConcept<_ValueType>)
__glibcxx_requires_valid_range(__first, __last);
- std::__push_heap(__first, _DistanceType((__last - __first) - 1),
- _DistanceType(0), _ValueType(*(__last - 1)),
- __gnu_cxx::__ops::less());
+ std::__push_heap<_ValueType>(__first,
+ _DistanceType((__last - __first) - 1),
+ _DistanceType(0),
+ __gnu_cxx::__move(*(__last - 1)),
+ __gnu_cxx::__ops::less());
}
- template<typename _RandomAccessIterator, typename _Distance,
- typename _Tp, typename _Compare>
+ template<typename _Tp, typename _RandomAccessIterator, typename _Distance,
+ typename _Compare>
void
__adjust_heap(_RandomAccessIterator __first, _Distance __holeIndex,
_Distance __len, _Tp __value, _Compare __comp)
@@ -193,28 +197,35 @@
if (__comp(*(__first + __secondChild),
*(__first + (__secondChild - 1))))
__secondChild--;
- *(__first + __holeIndex) = *(__first + __secondChild);
+ *(__first + __holeIndex) = __gnu_cxx::__move(*(__first +
+ __secondChild));
__holeIndex = __secondChild;
__secondChild = 2 * (__secondChild + 1);
}
if (__secondChild == __len)
{
- *(__first + __holeIndex) = *(__first + (__secondChild - 1));
+ *(__first + __holeIndex) = __gnu_cxx::__move(*(__first +
+ (__secondChild - 1)));
__holeIndex = __secondChild - 1;
}
- std::__push_heap(__first, __holeIndex, __topIndex, __value, __comp);
+ std::__push_heap<_Tp>(__first, __holeIndex, __topIndex,
+ __gnu_cxx::__move(__value), __comp);
}
- template<typename _RandomAccessIterator, typename _Tp, typename _Compare>
+ template<typename _RandomAccessIterator, typename _Compare>
inline void
__pop_heap(_RandomAccessIterator __first, _RandomAccessIterator __last,
- _RandomAccessIterator __result, _Tp __value, _Compare __comp)
+ _RandomAccessIterator __result, _Compare __comp)
{
typedef typename iterator_traits<_RandomAccessIterator>::difference_type
_Distance;
- *__result = *__first;
- std::__adjust_heap(__first, _Distance(0), _Distance(__last - __first),
- __value, __comp);
+ typedef typename iterator_traits<_RandomAccessIterator>::value_type
+ _ValueType;
+ _ValueType __value(__gnu_cxx::__move(*__result));
+ *__result = __gnu_cxx::__move(*__first);
+ std::__adjust_heap<_ValueType>(__first, _Distance(0),
+ _Distance(__last - __first),
+ __gnu_cxx::__move(__value), __comp);
}
/**
@@ -241,8 +252,7 @@
typedef typename iterator_traits<_RandomAccessIterator>::value_type
_ValueType;
- std::__pop_heap(__first, __last - 1, __last - 1,
- _ValueType(*(__last - 1)), __comp);
+ std::__pop_heap(__first, __last - 1, __last - 1, __comp);
}
/**
@@ -268,8 +278,8 @@
__glibcxx_requires_valid_range(__first, __last);
__glibcxx_requires_heap(__first, __last);
- std::__pop_heap(__first, __last - 1, __last - 1,
- _ValueType(*(__last - 1)), __gnu_cxx::__ops::less());
+ std::__pop_heap(__first, __last - 1, __last - 1,
+ __gnu_cxx::__ops::less());
}
/**
@@ -304,8 +314,10 @@
_DistanceType __parent = (__len - 2) / 2;
while (true)
{
- std::__adjust_heap(__first, __parent, __len,
- _ValueType(*(__first + __parent)), __comp);
+ std::__adjust_heap<_ValueType>(__first, __parent, __len,
+ __gnu_cxx::__move(*(__first +
+ __parent)),
+ __comp);
if (__parent == 0)
return;
__parent--;
diff -urN -x '*CVS*' libstdc++-v3.so_7.clean/testsuite/25_algorithms/heap/heap.cc libstdc++-v3/testsuite/25_algorithms/heap/heap.cc
--- libstdc++-v3.so_7.clean/testsuite/25_algorithms/heap/heap.cc 1970-01-01 01:00:00.000000000 +0100
+++ libstdc++-v3/testsuite/25_algorithms/heap/heap.cc 2003-11-11 20:09:16.000000000 +0000
@@ -0,0 +1,140 @@
+// Copyright (C) 2001 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 Pred 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.6 Heap operations [lib.alg.heap.operations]
+
+#include <algorithm>
+//#include <cmath>
+#include <testsuite_hooks.h>
+
+bool test __attribute__((unused)) = true;
+
+const int A[] = {1, 11, 12, 3, 10, 6, 17, 4, 8, 2, 5, 13, 9, 15, 14, 16, 7};
+const int B[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17};
+const int C[] = {17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1};
+const int N = sizeof(A) / sizeof(int);
+
+// This functor has the equivalent functionality of std::geater<>,
+// but there is no dependency on <functional> and it also tracks the
+// number of invocations since creation.
+class Gt
+{
+public:
+ static int count() { return itsCount; }
+ static void reset() { itsCount = 0; }
+
+ bool
+ operator()(const int& x, const int& y)
+ {
+ ++itsCount;
+ return x > y;
+ }
+
+private:
+ static int itsCount;
+};
+
+int Gt::itsCount = 0;
+
+// Exercise all of the heap functions for operator<. The
+// intermediate results between push_heap and pop_heap and
+// make_heap and sort_heap are not checked (they could be).
+void
+test01()
+{
+ // sort array s1 using push_heap/pop_heap
+ int s1[N];
+ std::copy(A, A + N, s1);
+ VERIFY(std::equal(s1, s1 + N, A));
+
+ for (int i = 2; i <= N; ++i) {
+ std::push_heap(s1, s1 + i);
+ }
+ for (int i = N; i >= 2; --i) {
+ std::pop_heap(s1, s1 + i);
+ }
+ VERIFY(std::equal(s1, s1 + N, B));
+
+ // sort array s2 using make_heap/sort_heap
+ int s2[N];
+ std::copy(A, A + N, s2);
+ VERIFY(std::equal(s2, s2 + N, A));
+
+ std::make_heap(s2, s2 + N);
+ std::sort_heap(s2, s2 + N);
+ VERIFY(std::equal(s2, s2 + N, B));
+}
+
+// Perform same tests as above but with the comparison predicate
+// versions, and add complexity constraint checks.
+void
+test02()
+{
+ Gt gt;
+// const int logN = static_cast<int>(std::log(static_cast<double>(N)) + 0.5);
+ const int logN = 3;
+
+ int s1[N];
+ std::copy(A, A + N, s1);
+ VERIFY(std::equal(s1, s1 + N, A));
+
+ for (int i = 2; i <= N; ++i) {
+ std::push_heap(s1, s1 + i, gt);
+#ifndef _GLIBCXX_DEBUG
+ VERIFY(gt.count() <= logN);
+#endif
+ gt.reset();
+ }
+
+ for (int i = N; i >= 2; --i) {
+ std::pop_heap(s1, s1 + i, gt);
+#ifndef _GLIBCXX_DEBUG
+ VERIFY(gt.count() <= 2 * logN);
+#endif
+ gt.reset();
+ }
+
+ VERIFY(std::equal(s1, s1 + N, C));
+
+ // sort array s2 using make_heap/sort_heap
+ int s2[N];
+ std::copy(A, A + N, s2);
+ VERIFY(std::equal(s2, s2 + N, A));
+
+ std::make_heap(s2, s2 + N, gt);
+#ifndef _GLIBCXX_DEBUG
+ VERIFY(gt.count() <= 3 * N);
+#endif
+ gt.reset();
+
+ std::sort_heap(s2, s2 + N, gt);
+#ifndef _GLIBCXX_DEBUG
+ VERIFY(gt.count() <= N * logN);
+#endif
+
+ VERIFY(std::equal(s2, s2 + N, C));
+}
+
+int
+main()
+{
+ test01();
+ test02();
+
+ return 0;
+}
diff -urN -x '*CVS*' libstdc++-v3.so_7.clean/testsuite/25_algorithms/heap/moveable.cc libstdc++-v3/testsuite/25_algorithms/heap/moveable.cc
--- libstdc++-v3.so_7.clean/testsuite/25_algorithms/heap/moveable.cc 1970-01-01 01:00:00.000000000 +0100
+++ libstdc++-v3/testsuite/25_algorithms/heap/moveable.cc 2005-05-16 17:42:59.000000000 +0100
@@ -0,0 +1,117 @@
+// 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 Pred 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.6 Heap operations [lib.alg.heap.operations]
+
+#undef _GLIBCXX_CONCEPT_CHECKS
+#define _GLIBCXX_TESTSUITE_ALLOW_RVALREF_ALISING
+
+#include <algorithm>
+#include <testsuite_hooks.h>
+#include <testsuite_iterators.h>
+#include <testsuite_rvalref.h>
+
+using __gnu_test::test_container;
+using __gnu_test::random_access_iterator_wrapper;
+using __gnu_test::rvalstruct;
+
+typedef test_container<rvalstruct, random_access_iterator_wrapper> container;
+
+bool test __attribute__((unused)) = true;
+
+
+void
+check_make(int* array, int length)
+{
+ rvalstruct makeheap[9];
+ std::copy(array, array + length, makeheap);
+ container makecon(makeheap, makeheap + length);
+ std::make_heap(makecon.begin(), makecon.end());
+ VERIFY(std::__is_heap(makecon.begin(), makecon.end()));
+ for(int z = 0; z < length; ++z)
+ VERIFY(makeheap[z].valid);
+}
+
+void
+check_pop(int* array, int length)
+{
+ rvalstruct popheap[9];
+ std::copy(array, array + length, popheap);
+ container popcon(popheap, popheap + length);
+ std::pop_heap(popcon.begin(), popcon.end());
+ VERIFY(std::__is_heap(popheap, popheap + length - 1));
+ for(int z = 0; z < length; ++z)
+ VERIFY(popheap[z].val <= popheap[length-1].val && popheap[z].valid);
+}
+
+void
+check_sort(int* array, int length)
+{
+ rvalstruct sortheap[9];
+ std::copy(array, array + length, sortheap);
+ container sortcon(sortheap, sortheap + length);
+ std::sort_heap(sortcon.begin(), sortcon.end());
+ for(int z = 0; z < length - 1; ++z)
+ VERIFY(sortheap[z].val <= sortheap[z + 1].val && sortheap[z].valid);
+ VERIFY(sortheap[length - 1].valid);
+}
+
+void
+check_push(int* array, int pushval, int length)
+{
+ rvalstruct pushheap[10];
+ std::copy(array, array + length, pushheap);
+ pushheap[length] = pushval;
+ container pushcon(pushheap, pushheap + length);
+ std::push_heap(pushcon.begin(), pushcon.end());
+ VERIFY(std::__is_heap(pushheap, pushheap + length));
+ for(int z = 0; z < length ; ++z)
+ VERIFY(pushheap[z].valid);
+}
+
+
+void
+test01()
+{
+ int array[9];
+ for(int i = 1; i < 9; ++i)
+ {
+ for(int z = 0; z < i; ++z)
+ array[i] = i;
+ while(std::next_permutation(array, array + i))
+ {
+ check_make(array, i);
+ if(std::__is_heap(array, array + i))
+ {
+ check_pop(array, i);
+ check_sort(array, i);
+ for(int pushval = -1; pushval <= i; ++pushval)
+ {
+ check_push(array, pushval, i);
+ }
+ }
+ }
+ }
+}
+
+int
+main()
+{
+ test01();
+ return 0;
+}
diff -urN -x '*CVS*' libstdc++-v3.so_7.clean/testsuite/25_algorithms/heap.cc libstdc++-v3/testsuite/25_algorithms/heap.cc
--- libstdc++-v3.so_7.clean/testsuite/25_algorithms/heap.cc 2005-02-09 23:22:33.000000000 +0000
+++ libstdc++-v3/testsuite/25_algorithms/heap.cc 1970-01-01 01:00:00.000000000 +0100
@@ -1,140 +0,0 @@
-// Copyright (C) 2001 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 Pred 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.6 Heap operations [lib.alg.heap.operations]
-
-#include <algorithm>
-//#include <cmath>
-#include <testsuite_hooks.h>
-
-bool test __attribute__((unused)) = true;
-
-const int A[] = {1, 11, 12, 3, 10, 6, 17, 4, 8, 2, 5, 13, 9, 15, 14, 16, 7};
-const int B[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17};
-const int C[] = {17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1};
-const int N = sizeof(A) / sizeof(int);
-
-// This functor has the equivalent functionality of std::geater<>,
-// but there is no dependency on <functional> and it also tracks the
-// number of invocations since creation.
-class Gt
-{
-public:
- static int count() { return itsCount; }
- static void reset() { itsCount = 0; }
-
- bool
- operator()(const int& x, const int& y)
- {
- ++itsCount;
- return x > y;
- }
-
-private:
- static int itsCount;
-};
-
-int Gt::itsCount = 0;
-
-// Exercise all of the heap functions for operator<. The
-// intermediate results between push_heap and pop_heap and
-// make_heap and sort_heap are not checked (they could be).
-void
-test01()
-{
- // sort array s1 using push_heap/pop_heap
- int s1[N];
- std::copy(A, A + N, s1);
- VERIFY(std::equal(s1, s1 + N, A));
-
- for (int i = 2; i <= N; ++i) {
- std::push_heap(s1, s1 + i);
- }
- for (int i = N; i >= 2; --i) {
- std::pop_heap(s1, s1 + i);
- }
- VERIFY(std::equal(s1, s1 + N, B));
-
- // sort array s2 using make_heap/sort_heap
- int s2[N];
- std::copy(A, A + N, s2);
- VERIFY(std::equal(s2, s2 + N, A));
-
- std::make_heap(s2, s2 + N);
- std::sort_heap(s2, s2 + N);
- VERIFY(std::equal(s2, s2 + N, B));
-}
-
-// Perform same tests as above but with the comparison predicate
-// versions, and add complexity constraint checks.
-void
-test02()
-{
- Gt gt;
-// const int logN = static_cast<int>(std::log(static_cast<double>(N)) + 0.5);
- const int logN = 3;
-
- int s1[N];
- std::copy(A, A + N, s1);
- VERIFY(std::equal(s1, s1 + N, A));
-
- for (int i = 2; i <= N; ++i) {
- std::push_heap(s1, s1 + i, gt);
-#ifndef _GLIBCXX_DEBUG
- VERIFY(gt.count() <= logN);
-#endif
- gt.reset();
- }
-
- for (int i = N; i >= 2; --i) {
- std::pop_heap(s1, s1 + i, gt);
-#ifndef _GLIBCXX_DEBUG
- VERIFY(gt.count() <= 2 * logN);
-#endif
- gt.reset();
- }
-
- VERIFY(std::equal(s1, s1 + N, C));
-
- // sort array s2 using make_heap/sort_heap
- int s2[N];
- std::copy(A, A + N, s2);
- VERIFY(std::equal(s2, s2 + N, A));
-
- std::make_heap(s2, s2 + N, gt);
-#ifndef _GLIBCXX_DEBUG
- VERIFY(gt.count() <= 3 * N);
-#endif
- gt.reset();
-
- std::sort_heap(s2, s2 + N, gt);
-#ifndef _GLIBCXX_DEBUG
- VERIFY(gt.count() <= N * logN);
-#endif
-
- VERIFY(std::equal(s2, s2 + N, C));
-}
-
-int
-main()
-{
- test01();
- test02();
-
- return 0;
-}
diff -urN -x '*CVS*' libstdc++-v3.so_7.clean/testsuite/25_algorithms/partition/moveable.cc libstdc++-v3/testsuite/25_algorithms/partition/moveable.cc
--- libstdc++-v3.so_7.clean/testsuite/25_algorithms/partition/moveable.cc 1970-01-01 01:00:00.000000000 +0100
+++ libstdc++-v3/testsuite/25_algorithms/partition/moveable.cc 2005-05-16 13:43:32.000000000 +0100
@@ -0,0 +1,81 @@
+// 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 Pred 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.12 [lib.alg.partitions] Partitions.
+
+#undef _GLIBCXX_CONCEPT_CHECKS
+
+#include <algorithm>
+#include <functional>
+#include <testsuite_hooks.h>
+#include <testsuite_rvalref.h>
+#include <testsuite_iterators.h>
+
+using __gnu_test::test_container;
+using __gnu_test::forward_iterator_wrapper;
+using __gnu_test::bidirectional_iterator_wrapper;
+using __gnu_test::rvalstruct;
+
+typedef test_container<rvalstruct, forward_iterator_wrapper> Fcontainer;
+typedef test_container<rvalstruct, bidirectional_iterator_wrapper> Bcontainer;
+
+bool test __attribute__((unused)) = true;
+
+const int A[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17};
+const int B[] = {2, 4, 6, 8, 10, 12, 14, 16, 1, 3, 5, 7, 9, 11, 13, 15, 17};
+const int N = sizeof(A) / sizeof(int);
+
+struct Pred
+{
+ bool
+ operator()(const rvalstruct& x) const
+ { return (x.val % 2) == 0; }
+};
+
+// 25.2.12 partition()
+void
+test01()
+{
+ using std::partition;
+
+ rvalstruct farray[N];
+ rvalstruct barray[N];
+
+ std::copy(A, A + N, farray);
+ std::copy(A, A + N, barray);
+
+ Fcontainer fcon(farray, farray + N);
+ Bcontainer bcon(barray, barray + N);
+
+ Pred pred;
+
+ VERIFY(partition(fcon.begin(), fcon.end(), pred).ptr - farray == N/2);
+ for (const rvalstruct* i = farray; i < farray+N/2; ++i) VERIFY(pred(*i));
+ for (const rvalstruct* i = farray+N/2; i < farray + N; ++i) VERIFY(!pred(*i));
+
+ VERIFY(partition(bcon.begin(), bcon.end(), pred).ptr - barray == N/2);
+ for (const rvalstruct* i = barray; i < barray+N/2; ++i) VERIFY(pred(*i));
+ for (const rvalstruct* i = barray+N/2; i < barray + N; ++i) VERIFY(!pred(*i));
+}
+
+int
+main()
+{
+ test01();
+ return 0;
+}
diff -urN -x '*CVS*' libstdc++-v3.so_7.clean/testsuite/25_algorithms/partition/partition.cc libstdc++-v3/testsuite/25_algorithms/partition/partition.cc
--- libstdc++-v3.so_7.clean/testsuite/25_algorithms/partition/partition.cc 1970-01-01 01:00:00.000000000 +0100
+++ libstdc++-v3/testsuite/25_algorithms/partition/partition.cc 2005-05-12 13:41:36.000000000 +0100
@@ -0,0 +1,73 @@
+// Copyright (C) 2001 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 Pred 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.12 [lib.alg.partitions] Partitions.
+
+#include <algorithm>
+#include <functional>
+#include <testsuite_hooks.h>
+
+bool test __attribute__((unused)) = true;
+
+const int A[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17};
+const int B[] = {2, 4, 6, 8, 10, 12, 14, 16, 1, 3, 5, 7, 9, 11, 13, 15, 17};
+const int N = sizeof(A) / sizeof(int);
+
+struct Pred
+{
+ bool
+ operator()(const int& x) const
+ { return (x % 2) == 0; }
+};
+
+// 25.2.12 partition()
+void
+test01()
+{
+ using std::partition;
+
+ int s1[N];
+ std::copy(A, A + N, s1);
+
+ Pred pred;
+ int* m = partition(s1, s1 + N, pred);
+ for (const int* i = s1; i < m; ++i) VERIFY(pred(*i));
+ for (const int* i = m; i < s1 + N; ++i) VERIFY(!pred(*i));
+}
+
+// 25.2.12 stable_partition()
+void
+test02()
+{
+ using std::stable_partition;
+
+ int s1[N];
+ std::copy(A, A + N, s1);
+
+ stable_partition(s1, s1 + N, Pred());
+ VERIFY(std::equal(s1, s1 + N, B));
+}
+
+int
+main()
+{
+ test01();
+ test02();
+
+ return 0;
+}
diff -urN -x '*CVS*' libstdc++-v3.so_7.clean/testsuite/25_algorithms/partition.cc libstdc++-v3/testsuite/25_algorithms/partition.cc
--- libstdc++-v3.so_7.clean/testsuite/25_algorithms/partition.cc 2003-09-23 21:02:52.000000000 +0100
+++ libstdc++-v3/testsuite/25_algorithms/partition.cc 1970-01-01 01:00:00.000000000 +0100
@@ -1,73 +0,0 @@
-// Copyright (C) 2001 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 Pred 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.12 [lib.alg.partitions] Partitions.
-
-#include <algorithm>
-#include <functional>
-#include <testsuite_hooks.h>
-
-bool test __attribute__((unused)) = true;
-
-const int A[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17};
-const int B[] = {2, 4, 6, 8, 10, 12, 14, 16, 1, 3, 5, 7, 9, 11, 13, 15, 17};
-const int N = sizeof(A) / sizeof(int);
-
-struct Pred
-{
- bool
- operator()(const int& x) const
- { return (x % 2) == 0; }
-};
-
-// 25.2.12 partition()
-void
-test01()
-{
- using std::partition;
-
- int s1[N];
- std::copy(A, A + N, s1);
-
- Pred pred;
- int* m = partition(s1, s1 + N, pred);
- for (const int* i = s1; i < m; ++i) VERIFY(pred(*i));
- for (const int* i = m; i < s1 + N; ++i) VERIFY(!pred(*i));
-}
-
-// 25.2.12 stable_partition()
-void
-test02()
-{
- using std::stable_partition;
-
- int s1[N];
- std::copy(A, A + N, s1);
-
- stable_partition(s1, s1 + N, Pred());
- VERIFY(std::equal(s1, s1 + N, B));
-}
-
-int
-main()
-{
- test01();
- test02();
-
- return 0;
-}
diff -urN -x '*CVS*' libstdc++-v3.so_7.clean/testsuite/25_algorithms/remove/moveable.cc libstdc++-v3/testsuite/25_algorithms/remove/moveable.cc
--- libstdc++-v3.so_7.clean/testsuite/25_algorithms/remove/moveable.cc 1970-01-01 01:00:00.000000000 +0100
+++ libstdc++-v3/testsuite/25_algorithms/remove/moveable.cc 2005-05-16 18:23:12.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 remove
+
+#undef _GLIBCXX_CONCEPT_CHECKS
+
+#include <algorithm>
+#include <testsuite_hooks.h>
+#include <testsuite_iterators.h>
+#include <testsuite_rvalref.h>
+
+using __gnu_test::test_container;
+using __gnu_test::forward_iterator_wrapper;
+using __gnu_test::rvalstruct;
+
+typedef test_container<rvalstruct, forward_iterator_wrapper> Container;
+
+void
+test1()
+{
+ int intarray[] = {1};
+ rvalstruct array[1];
+ std::copy(intarray, intarray + 1, array);
+ Container con(array, array + 1);
+ rvalstruct remove_val0(0);
+ rvalstruct remove_val1(1);
+ VERIFY(std::remove(con.begin(), con.end(), remove_val0).ptr == array + 1);
+ VERIFY(std::remove(con.begin(), con.end(), remove_val1).ptr == array);
+}
+
+void
+test2()
+{
+ int intarray[] = {0, 1, 0, 1, 0, 0, 1, 1};
+ rvalstruct array[8];
+ std::copy(intarray, intarray + 8, array);
+ Container con(array, array + 8);
+ rvalstruct remove_val(1);
+ VERIFY(std::remove(con.begin(), con.end(), remove_val).ptr == array + 4);
+ VERIFY(array[0].val == 0 && array[1].val == 0 && array[2].val == 0 &&
+ array[3].val == 0);
+}
+
+int
+main()
+{
+ test1();
+ test2();
+}
diff -urN -x '*CVS*' libstdc++-v3.so_7.clean/testsuite/25_algorithms/remove_if/1.cc libstdc++-v3/testsuite/25_algorithms/remove_if/1.cc
--- libstdc++-v3.so_7.clean/testsuite/25_algorithms/remove_if/1.cc 2005-03-14 10:38:08.000000000 +0000
+++ libstdc++-v3/testsuite/25_algorithms/remove_if/1.cc 2005-05-09 16:12:54.000000000 +0100
@@ -27,12 +27,15 @@
typedef test_container<int, forward_iterator_wrapper> Container;
+bool equal1(int val) { return val == 1; }
+bool equal0(int val) { return val == 0; }
+
void
test1()
{
int array[1];
Container con(array, array);
- VERIFY(std::remove(con.begin(), con.end(), 1).ptr == array);
+ VERIFY(std::remove_if(con.begin(), con.end(), equal1).ptr == array);
}
void
@@ -40,8 +43,8 @@
{
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);
+ VERIFY(std::remove_if(con.begin(), con.end(), equal0).ptr == array + 1);
+ VERIFY(std::remove_if(con.begin(), con.end(), equal1).ptr == array);
}
void
@@ -49,7 +52,7 @@
{
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(std::remove_if(con.begin(), con.end(), equal1).ptr == array + 4);
VERIFY(array[0] == 0 && array[1] == 0 && array[2] == 0 &&
array[3] == 0);
}
diff -urN -x '*CVS*' libstdc++-v3.so_7.clean/testsuite/25_algorithms/remove_if/moveable.cc libstdc++-v3/testsuite/25_algorithms/remove_if/moveable.cc
--- libstdc++-v3.so_7.clean/testsuite/25_algorithms/remove_if/moveable.cc 1970-01-01 01:00:00.000000000 +0100
+++ libstdc++-v3/testsuite/25_algorithms/remove_if/moveable.cc 2005-05-09 16:26:49.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 remove
+
+#undef _GLIBCXX_CONCEPT_CHECKS
+
+#include <algorithm>
+#include <testsuite_hooks.h>
+#include <testsuite_iterators.h>
+#include <testsuite_rvalref.h>
+
+using __gnu_test::test_container;
+using __gnu_test::forward_iterator_wrapper;
+using __gnu_test::rvalstruct;
+
+typedef test_container<rvalstruct, forward_iterator_wrapper> Container;
+
+bool equal1(rvalstruct& in) { return in.val == 1; }
+bool equal0(rvalstruct& in) { return in.val == 0; }
+
+void
+test1()
+{
+ int intarray[] = {1};
+ rvalstruct array[1];
+ std::copy(intarray, intarray + 1, array);
+ Container con(array, array + 1);
+ VERIFY(std::remove_if(con.begin(), con.end(), equal0).ptr == array + 1);
+ VERIFY(std::remove_if(con.begin(), con.end(), equal1).ptr == array);
+}
+
+void
+test2()
+{
+ int intarray[] = {0, 1, 0, 1, 0, 0, 1, 1};
+ rvalstruct array[8];
+ std::copy(intarray, intarray + 8, array);
+ Container con(array, array + 8);
+ VERIFY(std::remove_if(con.begin(), con.end(), equal1).ptr == array + 4);
+ VERIFY(array[0] == 0 && array[1] == 0 && array[2] == 0 &&
+ array[3] == 0);
+}
+
+int
+main()
+{
+ test1();
+ test2();
+}
diff -urN -x '*CVS*' libstdc++-v3.so_7.clean/testsuite/25_algorithms/reverse/moveable.cc libstdc++-v3/testsuite/25_algorithms/reverse/moveable.cc
--- libstdc++-v3.so_7.clean/testsuite/25_algorithms/reverse/moveable.cc 1970-01-01 01:00:00.000000000 +0100
+++ libstdc++-v3/testsuite/25_algorithms/reverse/moveable.cc 2005-05-09 16:43:14.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.2.9 Reverse
+
+// { dg-do compile }
+
+#undef _GLIBCXX_CONCEPT_CHECKS
+
+#include <algorithm>
+#include <testsuite_iterators.h>
+
+using __gnu_test::bidirectional_iterator_wrapper;
+
+class X {
+X();
+X(const X&);
+void operator=(const X&);
+};
+
+void
+swap(X&, X&) { }
+
+void
+test1(bidirectional_iterator_wrapper<X>& begin,
+ bidirectional_iterator_wrapper<X>& end)
+{ std::reverse(begin, end); }
diff -urN -x '*CVS*' libstdc++-v3.so_7.clean/testsuite/25_algorithms/rotate/moveable.cc libstdc++-v3/testsuite/25_algorithms/rotate/moveable.cc
--- libstdc++-v3.so_7.clean/testsuite/25_algorithms/rotate/moveable.cc 1970-01-01 01:00:00.000000000 +0100
+++ libstdc++-v3/testsuite/25_algorithms/rotate/moveable.cc 2005-05-09 17:09:55.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.10 rotate
+
+// Tests rotate when an moveable class is used
+
+#undef _GLIBCXX_CONCEPT_CHECKS
+
+#include <algorithm>
+#include <testsuite_hooks.h>
+#include <testsuite_iterators.h>
+#include <testsuite_rvalref.h>
+
+using __gnu_test::test_container;
+using __gnu_test::forward_iterator_wrapper;
+using __gnu_test::bidirectional_iterator_wrapper;
+using __gnu_test::random_access_iterator_wrapper;
+using __gnu_test::rvalstruct;
+
+typedef test_container<rvalstruct, forward_iterator_wrapper> Fcontainer;
+typedef test_container<rvalstruct, bidirectional_iterator_wrapper> Bcontainer;
+typedef test_container<rvalstruct, random_access_iterator_wrapper> Rcontainer;
+
+
+
+void
+test1()
+{
+ bool test __attribute__((unused)) = true;
+ int data[] = {1, 2, 3, 4, 5};
+ rvalstruct array[5];
+ std::copy(data, data + 5, array);
+ Fcontainer fcon(array, array + 5);
+ Bcontainer bcon(array, array + 5);
+ Rcontainer rcon(array, array + 5);
+
+ std::rotate(fcon.begin(), fcon.it(2), fcon.end());
+ VERIFY(array[0].val == 3 && array[1].val == 4 && array[2].val == 5 &&
+ array[3].val == 1 && array[4].val == 2);
+ for(int i=0;i<5;i++)
+ VERIFY(array[i].valid == true);
+
+ std::rotate(bcon.begin(), bcon.it(2), bcon.end());
+ VERIFY(array[0].val == 5 && array[1].val == 1 && array[2].val == 2 &&
+ array[3].val == 3 && array[4].val == 4);
+ for(int i=0;i<5;i++)
+ VERIFY(array[i].valid);
+
+ std::rotate(rcon.begin(), rcon.it(2), rcon.end());
+ VERIFY(array[0].val == 2 && array[1].val == 3 && array[2].val == 4 &&
+ array[3].val == 5 && array[4].val == 1);
+ for(int i=0;i<5;i++)
+ VERIFY(array[i].valid);
+}
+
+int
+main()
+{
+ test1();
+}
diff -urN -x '*CVS*' libstdc++-v3.so_7.clean/testsuite/25_algorithms/swap_ranges/check_type.cc libstdc++-v3/testsuite/25_algorithms/swap_ranges/check_type.cc
--- libstdc++-v3.so_7.clean/testsuite/25_algorithms/swap_ranges/check_type.cc 2005-03-29 17:32:33.000000000 +0100
+++ libstdc++-v3/testsuite/25_algorithms/swap_ranges/check_type.cc 2005-05-16 17:04:00.000000000 +0100
@@ -25,16 +25,10 @@
using __gnu_test::forward_iterator_wrapper;
-class X {
-X();
-X(const X&);
-void operator=(const X&);
+struct X {
};
void
-swap(X&, X&) { }
-
-void
test1(forward_iterator_wrapper<X>& begin,
forward_iterator_wrapper<X>& end,
forward_iterator_wrapper<X>& begin2)
diff -urN -x '*CVS*' libstdc++-v3.so_7.clean/testsuite/25_algorithms/swap_ranges/moveable.cc libstdc++-v3/testsuite/25_algorithms/swap_ranges/moveable.cc
--- libstdc++-v3.so_7.clean/testsuite/25_algorithms/swap_ranges/moveable.cc 1970-01-01 01:00:00.000000000 +0100
+++ libstdc++-v3/testsuite/25_algorithms/swap_ranges/moveable.cc 2005-05-09 14:51:50.000000000 +0100
@@ -0,0 +1,43 @@
+// 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 Swap Ranges
+
+// { dg-do compile }
+
+#undef _GLIBCXX_CONCEPT_CHECKS
+
+#include <algorithm>
+#include <testsuite_iterators.h>
+
+using __gnu_test::forward_iterator_wrapper;
+
+class X {
+X();
+X(const X&);
+void operator=(const X&);
+};
+
+void
+swap(X&, X&) { }
+
+void
+test1(forward_iterator_wrapper<X>& begin,
+ forward_iterator_wrapper<X>& end,
+ forward_iterator_wrapper<X>& begin2)
+{ std::swap_ranges(begin, end, begin2); }
diff -urN -x '*CVS*' libstdc++-v3.so_7.clean/testsuite/25_algorithms/unique/moveable.cc libstdc++-v3/testsuite/25_algorithms/unique/moveable.cc
--- libstdc++-v3.so_7.clean/testsuite/25_algorithms/unique/moveable.cc 2005-04-20 22:25:05.000000000 +0100
+++ libstdc++-v3/testsuite/25_algorithms/unique/moveable.cc 2005-05-09 14:52:32.000000000 +0100
@@ -18,6 +18,8 @@
// 25.2.8 [lib.alg.unique] Unique
+#undef _GLIBCXX_CONCEPT_CHECKS
+
#include <vector>
#include <algorithm>
#include <functional>
diff -urN -x '*CVS*' libstdc++-v3.so_7.clean/testsuite/testsuite_rvalref.h libstdc++-v3/testsuite/testsuite_rvalref.h
--- libstdc++-v3.so_7.clean/testsuite/testsuite_rvalref.h 2005-04-20 22:25:04.000000000 +0100
+++ libstdc++-v3/testsuite/testsuite_rvalref.h 2005-05-16 18:26:12.000000000 +0100
@@ -38,19 +38,35 @@
class rvalstruct
{
- rvalstruct(const rvalstruct&);
bool
operator=(const rvalstruct&);
+
+// Normally we don't define a copy constructor, as any use of it would
+// show an inefficency. In some cases we know it will be alised away
+// by the compiler, but it still insists it is defined, so we provide
+// a way of making it public but not giving a body, so any usage would
+// instead fail at link-time.
+#ifdef _GLIBCXX_TESTSUITE_ALLOW_RVALREF_ALISING
public:
+ rvalstruct(const rvalstruct&);
+#else
+ rvalstruct(const rvalstruct&);
+
+ public:
+#endif
int val;
bool valid;
rvalstruct() : valid(false)
{ }
+ rvalstruct(int inval) : val(inval), valid(true)
+ { }
+
rvalstruct&
operator=(int newval)
{
+ VERIFY(valid == false);
val = newval;
valid = true;
}
Attachment:
ChangeLog-rvalref
Description: application/text
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |