[Patch, libstdc++/64584, libstdc++/64585] Clear basic_regex after imbue and make assign exception tolerant
Marc Glisse
marc.glisse@inria.fr
Fri Jan 16 13:34:00 GMT 2015
On Fri, 16 Jan 2015, Jonathan Wakely wrote:
> Am I missing something here, why are you moving the iterators?
>
> Iterators are cheap to copy, so moving them is not necessary.
(I am not talking about this patch in particular)
Iterators are supposed to be relatively cheap to copy. In practice, that
copy doesn't always come for free. When you implemented filesystem
iterators, IIRC you had at least a shared_ptr in your iterators, so
copying involved some atomic operations and those have a cost (first a
direct cost on the system, but also an optimization cost because we can't
simplify 5 consecutive copies to only one). I have seen iterators that
were even more expensive (and inconvenient to make cheaper). If we can
internally reduce the number of copies (move instead, pass by reference,
etc), that seems good to me. I wanted to make a pass on predefined_ops.h
but didn't find the time.
--
Marc Glisse
More information about the Libstdc++
mailing list