[RFC] list::remove vs const& arguments...
Paolo Carlini
pcarlini@suse.de
Tue Sep 14 15:43:00 GMT 2004
Hi Jonathan,
>It would seem to be easy to fix std::list<T>::remove() by using a
>local copy of the value, since T is required to be CopyConstructible.
>
>
Indeed, Chris already proposed that in the audit trail, and could even
*improve*
the performance, as a nice side effect. However, in std::fill (where at
issue was
performance alone) we do that *only* when the type is "cheap to copy"
(fits in
a register, more correctly: I should do some renaming asap) not
unconditionally.
Therefore, it seems to me that we should first make sure that in the
present case
is needed for conformance. But let's think about this a bit more... thanks.
>The same isn't true for std::remove() AFAICT.
>
>But anyway ...
>
>As an aside, why does std::remove() have this requirement?
>
> __glibcxx_function_requires(_ConvertibleConcept<_Tp,
> typename iterator_traits<_ForwardIterator>::value_type>)
>
>This seems too restrictive to me - there's no assignment from _Tp
>to the iterator's value_type, so why require the conversion?
>
>
I agree, requiring that seems definitely wrong. Please wait 'til tomorrow in
case I'm missing something: if nobody further comments the patch is ok for
mainline and 3_4-branch.
Thanks,
Paolo.
More information about the Libstdc++
mailing list