Subject: Re: [boost] Adding polymorphic_value to boost
From: Thorsten Ottosen (tottosen_at_[hidden])
Date: 2017-11-23 15:24:07
Den 23-11-2017 kl. 00:31 skrev Phil Endecott via Boost:
> There's another way of implementing this, though; rather than
> pointing to the object in the heap you can store it in-place
> by allocating enough space for the largest possible derived
> That's just a sketch; many details omitted!Â There are some obvious
> advantages and disadvantages of each approach and I'm definitely not
> saying this is better than the pointer-to-heap design.
That's going to use way too much space, make swap/move slow and possibly
noexcept(false), give poor reference stability. For that case of not
heap-allocating each object in isolation, boost::poly_collection seems
much better. So I would stick to the allocate on the heap approach.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk