Boost logo

Boost :

Subject: Re: [boost] Adding polymorphic_value to boost
From: Peter Dimov (lists_at_[hidden])
Date: 2017-11-20 15:43:20

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 available.

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