
AMDG On 10/29/2012 02:59 PM, Mathias Gaunard wrote:
On 29/10/12 22:33, Dave Abrahams wrote:
As I had feared, and as http://news.gmane.org/find-root.php?message_id=%3cm2objlggaw.fsf%40pluto.lua...
demonstrates, extra dynamic allocations will be used to store maps and vectors (or anything at all?) in the variant.
Why not fix the implementation then instead of writing hacks?
There's no automatic way around dynamic allocation. a) vector<variant<...> > requires variant to be complete. b) variant<std::vector<...> > requires vector to be complete because it needs to know the sizeof(std::vector<...>). The only way to break the cyclic dependency is to make the size of variant not depend on the size of the vector.
Of course, the code of variant is horrible enough to make it very difficult to do anything with it.
In Christ, Steven Watanabe