DR 538, [Ready]
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. From-SVN: r112818
This commit is contained in:
parent
cf26aa8910
commit
9f889fcf52
|
@ -1,3 +1,13 @@
|
||||||
|
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>
|
2006-03-29 Benjamin Kosnik <bkoz@redhat.com>
|
||||||
|
|
||||||
* testsuite/data/sgetn.txt: Correct copyright holder.
|
* testsuite/data/sgetn.txt: Correct copyright holder.
|
||||||
|
|
|
@ -573,6 +573,14 @@
|
||||||
<dd>Add <code>data()</code> to <code>std::vector</code> and
|
<dd>Add <code>data()</code> to <code>std::vector</code> and
|
||||||
<code>at(const key_type&)</code> to <code>std::map</code>.
|
<code>at(const key_type&)</code> to <code>std::map</code>.
|
||||||
</dd>
|
</dd>
|
||||||
|
|
||||||
|
<dt><a href="lwg-active.html#538">538</a>:
|
||||||
|
<em>DR 538. 241 again: Does unique_copy() require CopyConstructible
|
||||||
|
and Assignable?</em>
|
||||||
|
</dt>
|
||||||
|
<dd>In case of input_iterator/output_iterator rely on Assignability of
|
||||||
|
input_iterator' value_type.
|
||||||
|
</dd>
|
||||||
<!--
|
<!--
|
||||||
<dt><a href="lwg-defects.html#"></a>:
|
<dt><a href="lwg-defects.html#"></a>:
|
||||||
<em></em>
|
<em></em>
|
||||||
|
|
|
@ -1340,18 +1340,14 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
|
||||||
input_iterator_tag, output_iterator_tag)
|
input_iterator_tag, output_iterator_tag)
|
||||||
{
|
{
|
||||||
// concept requirements -- taken care of in dispatching function
|
// concept requirements -- taken care of in dispatching function
|
||||||
*__result = *__first;
|
typename iterator_traits<_InputIterator>::value_type __value = *__first;
|
||||||
while (true)
|
*__result = __value;
|
||||||
{
|
while (++__first != __last)
|
||||||
typename
|
if (!(__value == *__first))
|
||||||
iterator_traits<_InputIterator>::value_type __value = *__first;
|
{
|
||||||
|
__value = *__first;
|
||||||
if (++__first == __last)
|
*++__result = __value;
|
||||||
break;
|
}
|
||||||
|
|
||||||
if (!(__value == *__first))
|
|
||||||
*++__result = *__first;
|
|
||||||
}
|
|
||||||
return ++__result;
|
return ++__result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1427,18 +1423,14 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
|
||||||
typename iterator_traits<_InputIterator>::value_type,
|
typename iterator_traits<_InputIterator>::value_type,
|
||||||
typename iterator_traits<_InputIterator>::value_type>)
|
typename iterator_traits<_InputIterator>::value_type>)
|
||||||
|
|
||||||
*__result = *__first;
|
typename iterator_traits<_InputIterator>::value_type __value = *__first;
|
||||||
while (true)
|
*__result = __value;
|
||||||
{
|
while (++__first != __last)
|
||||||
typename
|
if (!__binary_pred(__value, *__first))
|
||||||
iterator_traits<_InputIterator>::value_type __value = *__first;
|
{
|
||||||
|
__value = *__first;
|
||||||
if (++__first == __last)
|
*++__result = __value;
|
||||||
break;
|
}
|
||||||
|
|
||||||
if (!__binary_pred(__value, *__first))
|
|
||||||
*++__result = *__first;
|
|
||||||
}
|
|
||||||
return ++__result;
|
return ++__result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1485,6 +1477,10 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
|
||||||
* @if maint
|
* @if maint
|
||||||
* _GLIBCXX_RESOLVE_LIB_DEFECTS
|
* _GLIBCXX_RESOLVE_LIB_DEFECTS
|
||||||
* DR 241. Does unique_copy() require CopyConstructible and Assignable?
|
* 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
|
* @endif
|
||||||
*/
|
*/
|
||||||
template<typename _InputIterator, typename _OutputIterator>
|
template<typename _InputIterator, typename _OutputIterator>
|
||||||
|
|
|
@ -1,93 +0,0 @@
|
||||||
// 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();
|
|
||||||
}
|
|
Loading…
Reference in New Issue