[libstdc++] Problems with unique (patch included)
Peter Schmid
schmid@snake.iap.physik.tu-darmstadt.de
Thu Jul 19 11:11:00 GMT 2001
Calling the unique function does no longer work for the version of
libstdc++ that is shipped with gcc 3.1.
For example, the following source code tu.C does not compile:
The appended patch fixes two typos in include/g++-v3/bits/stl_algo.h.
Hope this helps,
Peter Schmid
#include <list>
#include <algorithm>
using namespace std;
int main()
{
list<int> menge;
unique (menge.begin(), menge.end());
}
g++ tu.C -W -Wall
/usr/local/include/g++-v3/bits/stl_algo.h: In function `_OutputIter
std::unique_copy(_InputIter, _InputIter, _OutputIter) [with _InputIter =
std::_List_iterator<int, int&, int*>, _OutputIter = std::_List_iterator<int,
int&, int*>]':
/usr/local/include/g++-v3/bits/stl_algo.h:913: instantiated from `_ForwardIter std::unique(_ForwardIter, _ForwardIter) [with _ForwardIter = std::_List_iterator<int, int&, int*>]'
tu.C:8: instantiated from here
/usr/local/include/g++-v3/bits/stl_algo.h:840: no type named
`iterator_catgeory' in `struct std::iterator_traits<std::_List_iterator<int,
int&, int*> >'
/usr/local/include/g++-v3/bits/stl_algo.h:843: no type named
`iterator_catgeory' in `struct std::iterator_traits<std::_List_iterator<int,
int&, int*> >'
2001-07-06 Peter Schmid <schmid@snake.iap.physik.tu-darmstadt.de>
* include/bits/stl_algo.h : Fix typos.
*** libstdc++-v3/include/bits/stl_algo.h.orig Thu Jul 19 19:59:14 2001
--- libstdc++-v3/include/bits/stl_algo.h Thu Jul 19 19:59:26 2001
*************** namespace std
*** 837,843 ****
__glibcpp_function_requires(_EqualityComparableConcept<
typename iterator_traits<_InputIter>::value_type>);
! typedef typename iterator_traits<_OutputIter>::iterator_catgeory _IterType;
if (__first == __last) return __result;
return __unique_copy(__first, __last, __result, _IterType());
--- 837,843 ----
__glibcpp_function_requires(_EqualityComparableConcept<
typename iterator_traits<_InputIter>::value_type>);
! typedef typename iterator_traits<_OutputIter>::iterator_category _IterType;
if (__first == __last) return __result;
return __unique_copy(__first, __last, __result, _IterType());
*************** namespace std
*** 894,900 ****
__glibcpp_function_requires(_OutputIteratorConcept<_OutputIter,
typename iterator_traits<_InputIter>::value_type>);
! typedef typename iterator_traits<_OutputIter>::iterator_catgeory _IterType;
if (__first == __last) return __result;
return __unique_copy(__first, __last, __result, __binary_pred, _IterType());
--- 894,900 ----
__glibcpp_function_requires(_OutputIteratorConcept<_OutputIter,
typename iterator_traits<_InputIter>::value_type>);
! typedef typename iterator_traits<_OutputIter>::iterator_category _IterType;
if (__first == __last) return __result;
return __unique_copy(__first, __last, __result, __binary_pred, _IterType());
More information about the Libstdc++
mailing list