|
Boost : |
Subject: Re: [boost] Adding polymorphic_value to boost
From: Vicente J. Botet Escriba (vicente.botet_at_[hidden])
Date: 2017-11-19 04:10:10
Le 16/11/2017 à 10:14, Jonathan Coe via Boost a écrit :
> I'd like to propose adding the class-template `polymorphic_value` to boost.
>
> `polymorphic_value` is designed to allow the compiler to correctly generate
> special member functions for classes with polymorphic components (It's
> `any` with an interface).
>
> `polymorphic_value` has been proposed for standardisation in P0201 and has
> advanced through the Library Evolution group in Albuquerque (Nov 5-10).
> https://wg21.link/p0201
>
> A working draft of the proposal and implementation can be found at
> https://github.com/jbcoe/polymorphic_value
>
> I gave a presentation about polymorphic_value at C++::London here:
> https://skillsmatter.com/skillscasts/9539-a-polymorphic-value-type-for-c-plus-plus
>
> Matt Calabrese has kindly offered to be review manager.
>
Hi Jonathan,
I'll be all for having `polymorphic_value` in Boost so that we can play
with this class.
However, I would like to see also your original `cloning_ptr` and the
`propagate_const` and see how `polymorphic_value` can be built on top of
these classes. This will be the occasion to prove what you said in your
paper p0201r2 ;-)
Of course, we can review `polymorphic_value` independnetly of
`cloning_ptr` and the `propagate_const`.
"Design changes from cloned_ptr
The design of polymorphic_value is based upon cloned_ptr after advice
from LEWG. The authors would like to make LEWG explicitly aware of the
cost of these design changes.
polymorphic_value has value-like semantics: copies are deep and const is
propagated to the owned object. The first revision of this paper
presented cloned_ptr which had mixed pointer/value semantics: copies are
deep but const is not propagated to the owned object. polymorphic_value
can be built from cloned_ptr and propagate_const but there is no way to
remove const propagation from polymorphic_value.
As polymorphic_value is a value, dynamic_pointer_cast,
static_pointer_cast and const_pointer_cast are not provided. If a
polymorphic_value is constructed with a custom copier or deleter, then
there is no way for a user to implement the cast operations provided for
cloned_ptr.
[Should we be standardizing vocabulary types (optional, variant and
polymorphic_value) or components through which vocabulary types can be
trivially composed (propagate_const, cloned_ptr)?]"
Best,
Vicente
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk