+2006-04-10 Paolo Carlini <pcarlini@suse.de>
+
+ DR 538, [Ready]
+ * include/bits/stl_algo.h (__unique_copy(,,, input_iterator_tag,
+ output_iterator_tag), and predicated counterpart): Revert to the
+ algorithm pre-DR 241, i.e., value_type of InputIterator is now
+ required to be Assignable too.
+ * testsuite/25_algorithms/unique_copy/3.cc: Remove.
+ * docs/html/ext/howto.html: Add an entry for DR 538.
+
2006-03-29 Benjamin Kosnik <bkoz@redhat.com>
* testsuite/data/sgetn.txt: Correct copyright holder.
input_iterator_tag, output_iterator_tag)
{
// concept requirements -- taken care of in dispatching function
- *__result = *__first;
- while (true)
- {
- typename
- iterator_traits<_InputIterator>::value_type __value = *__first;
-
- if (++__first == __last)
- break;
-
- if (!(__value == *__first))
- *++__result = *__first;
- }
+ typename iterator_traits<_InputIterator>::value_type __value = *__first;
+ *__result = __value;
+ while (++__first != __last)
+ if (!(__value == *__first))
+ {
+ __value = *__first;
+ *++__result = __value;
+ }
return ++__result;
}
typename iterator_traits<_InputIterator>::value_type,
typename iterator_traits<_InputIterator>::value_type>)
- *__result = *__first;
- while (true)
- {
- typename
- iterator_traits<_InputIterator>::value_type __value = *__first;
-
- if (++__first == __last)
- break;
-
- if (!__binary_pred(__value, *__first))
- *++__result = *__first;
- }
+ typename iterator_traits<_InputIterator>::value_type __value = *__first;
+ *__result = __value;
+ while (++__first != __last)
+ if (!__binary_pred(__value, *__first))
+ {
+ __value = *__first;
+ *++__result = __value;
+ }
return ++__result;
}
* @if maint
* _GLIBCXX_RESOLVE_LIB_DEFECTS
* DR 241. Does unique_copy() require CopyConstructible and Assignable?
+ *
+ * _GLIBCXX_RESOLVE_LIB_DEFECTS
+ * DR 538. 241 again: Does unique_copy() require CopyConstructible and
+ * Assignable?
* @endif
*/
template<typename _InputIterator, typename _OutputIterator>
+++ /dev/null
-// Copyright (C) 2006 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, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
-// USA.
-
-// 25.2.8 [lib.alg.unique]
-
-#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;
-using std::unique_copy;
-using std::equal_to;
-
-struct no_assign
-{
- int const x;
- no_assign() : x(23) { }
- no_assign(int val) : x(val) { }
- operator int() const { return x; }
-};
-
-typedef test_container<no_assign, input_iterator_wrapper> Icontainer;
-typedef test_container<int, output_iterator_wrapper> Ocontainer;
-
-no_assign array1[] = {0, 0, 0, 1, 1, 1};
-int array2[2];
-
-void
-test1()
-{
- bool test __attribute__((unused)) = true;
- Icontainer con1(array1, array1);
- Ocontainer con2(array2, array2);
- VERIFY( unique_copy(con1.begin(), con1.end(), con2.begin()).ptr == array2 );
-}
-
-void
-test2()
-{
- bool test __attribute__((unused)) = true;
- Icontainer con1(array1, array1 + 6);
- Ocontainer con2(array2, array2 + 2);
- VERIFY( unique_copy(con1.begin(), con1.end(), con2.begin()).ptr
- == array2 + 2 );
- VERIFY( array2[0] == 0 && array2[1] == 1 );
-}
-
-void
-test3()
-{
- bool test __attribute__((unused)) = true;
- Icontainer con1(array1, array1);
- Ocontainer con2(array2, array2);
- VERIFY( unique_copy(con1.begin(), con1.end(), con2.begin(),
- equal_to<int>()).ptr == array2 );
-}
-
-void
-test4()
-{
- bool test __attribute__((unused)) = true;
- Icontainer con1(array1, array1 + 6);
- Ocontainer con2(array2, array2 + 2);
- VERIFY( unique_copy(con1.begin(), con1.end(), con2.begin(),
- equal_to<int>()).ptr == array2 + 2 );
- VERIFY( array2[0] == 0 && array2[1] == 1 );
-}
-
-int
-main()
-{
- test1();
- test2();
- test3();
- test4();
-}