Boost logo

Boost :

Subject: Re: [boost] [variant] awkward recursion
From: Gottlob Frege (gottlobfrege_at_[hidden])
Date: 2012-10-31 12:06:06


On Tue, Oct 30, 2012 at 10:16 PM, Steven Watanabe <watanabesj_at_[hidden]> wrote:
>
> Not really.
>
> "no swap() function invalidates any references,
> pointers, or iterators referring to the elements
> of the containers being swapped." (C++11 23.2.1.10)
>
> I don't know of any way to implement this with the
> small object optimization.
>

"Challenge accepted"?

Well, depends what is meant by pointers and references. Actual
pointers and references, or vector<>::pointer_type, etc?

Because, at least for iterators, you could keep a list of outstanding
iterators and update them during swap.
Typically not a good idea, but possible.

Same for pointer/reference if they only need to be pointer-like and
reference-like.

Also, I suppose my vector could have small object optimization until a
pointer/reference was taken. Again, probably not a brilliant plan...

Tony


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk