Subject: Re: [boost] Adding polymorphic_value to boost
From: Jonathan Coe (jonathanbcoe_at_[hidden])
Date: 2017-11-20 16:34:06
On 20 November 2017 at 15:43, Peter Dimov via Boost <boost_at_[hidden]>
> Richard Hodges wrote:
> It seems to me that the previous name of cloned_ptr is a better choice.
> _value is fine IMO. You can have
> vector<polymorphic_value<Shape>> v;
> and then
> v.push_back( Circle(10) );
> v.push_back( Ellipse(10, 15) );
> v.push_back( Square(11) );
> I would drop the U* constructor though. It's a remnant of the times this
> was called a pointer. U&& is all that's needed.
> It's unfortunate we have to use -> instead of . but that's what's
The pointer constructor is needed in migration paths from class heirarchies
with a `Clone()` method. It also allows one to support objects coming from
I'd avoid using it, but it does have its uses.
> Unsubscribe & other changes: http://lists.boost.org/mailman
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk