This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [v3] Small improvement for stf::fill/fill_n
- From: Paolo Carlini <pcarlini at suse dot de>
- To: Paolo Carlini <pcarlini at suse dot de>
- Cc: "'gcc-patches at gcc dot gnu dot org'" <gcc-patches at gcc dot gnu dot org>,Dan Nicolaescu <dann at godzilla dot ics dot uci dot edu>
- Date: Fri, 25 Jun 2004 12:51:22 +0200
- Subject: Re: [v3] Small improvement for stf::fill/fill_n
- References: <40DBF0B9.8080506@suse.de>
Paolo Carlini wrote:
the below is what I have applied to mainline, regtested x86-linux.
The below fixes a rather serious thinko in it, sorry.
Paolo.
///////////////
2004-06-25 Paolo Carlini <pcarlini@suse.de>
* include/bits/stl_algobase.h (fill, fill_n): Tighten the
dispatch: use iterator_traits<>::value_type, not _Tp.
diff -urN libstdc++-v3-orig/include/bits/stl_algobase.h libstdc++-v3/include/bits/stl_algobase.h
--- libstdc++-v3-orig/include/bits/stl_algobase.h 2004-06-25 11:25:56.000000000 +0200
+++ libstdc++-v3/include/bits/stl_algobase.h 2004-06-25 12:34:39.000000000 +0200
@@ -546,7 +546,8 @@
_ForwardIterator>)
__glibcxx_requires_valid_range(__first, __last);
- typedef typename __type_traits<_Tp>::has_trivial_copy_constructor
+ typedef typename iterator_traits<_ForwardIterator>::value_type _ValueType;
+ typedef typename __type_traits<_ValueType>::has_trivial_copy_constructor
_Trivial;
std::__fill<_Trivial>::fill(__first, __last, __value);
}
@@ -621,7 +622,8 @@
// concept requirements
__glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator, _Tp>)
- typedef typename __type_traits<_Tp>::has_trivial_copy_constructor
+ typedef typename iterator_traits<_OutputIterator>::value_type _ValueType;
+ typedef typename __type_traits<_ValueType>::has_trivial_copy_constructor
_Trivial;
return std::__fill_n<_Trivial>::fill_n(__first, __n, __value);
}