Boost logo

Boost :

Subject: Re: [boost] Interest in a "Heterogenous Container" system?
From: Mathias Gaunard (mathias.gaunard_at_[hidden])
Date: 2009-06-29 07:51:17

Christian Schladetsch wrote:

> boost::variant doesnt support custom allocators. it uses naked new and
> delete.

variant stores objects within itself. If you declare a variant on the
stack, your object lies on the stack.

The temporary heap backup is only there in operator= and only when you
don't have a nothrow move or nothrow default constructor on one of your
And it's only used for a few instructions unless you throw anyway, so
who cares about what allocator it uses.

Alternatively, it could also store the backup in the object itself to
avoid heap allocations, but that would double its size.

Boost list run by bdawes at, gregod at, cpdaniel at, john at