
AMDG On 10/30/2012 07:11 AM, Dave Abrahams wrote:
on Mon Oct 29 2012, Steven Watanabe <watanabesj-AT-gmail.com> wrote:
The only way to break the cyclic dependency is to make the size of variant not depend on the size of the vector.
Yup. We "know" the indirection is already there in std::vector/map, but we can't use it. Yes, I realize that the implementation is free to do the small object optimization,
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.
which *could* blow our assumption that the indirection isn't needed... but in practice, it doesn't. Tant pis.
I believe that I've seen tickets in trac indicating that at least one STL implementation checks that the element type is complete, so we can't even assume that it works in practice. In Christ, Steven Watanabe