Implementing clean and simple move symantics
chris
caj@cs.york.ac.uk
Wed Nov 24 17:50:00 GMT 2004
Martin Sebor wrote:
> Chris Jefferson wrote:
> ...
>
>> Hmm.. I'll have to think about this a bit. In actual fact, I think
>> all of the standard containers look like they can be moved by memmove,
>
>
> I'm not sure about your implementation but ours stores the allocator
> object in the container and in the rare case when the allocator has
> non-trivial state the container may not be movable. But I haven't
> been following this whole thread and you may have already discussed
> this case and dealt with it. In that case, sorry about butting in :)
Hmm.. in the current vector::swap, when we swap two vectors we don't
swap their allocators if their allocators are of the same type... could
this be wrong / bad?
You are right however. The easy fix for this is to not optimise for
people who use non-standard allocators. Out of interest, how frequently
do people actually use non-standard allocators? (I can't say I've seen
one, but I haven't seen that much C++ code.)....
Chris
More information about the Libstdc++
mailing list