Fwd: Adding polymorphic_value to boost

Previous Topic Next Topic
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Fwd: Adding polymorphic_value to boost

Boost - Dev mailing list
On 19 November 2017 at 23:41, <[hidden email]> wrote:

> Message: 12
> Date: Mon, 20 Nov 2017 01:41:10 +0200
> From: "Peter Dimov" <[hidden email]>
> To: <[hidden email]>
> Subject: Re: [boost] Adding polymorphic_value to boost
> Message-ID: <E0D82A60493A491CBFFD0E264E3917D1@pdimov5>
> Content-Type: text/plain; format=flowed; charset="iso-8859-1";
>         reply-type=original
> Peter Bartlett wrote:
> > The only nit I had in the paper was that after all the banging on about
> it
> > being a value type, we are given operator bool, operator* and operator->,
> > making it pointer-like again. Could operator T& and operator T const&
> > work?
> Polymorphic means virtual functions, and when you have a
> polymorphic_value<T> pv, where T has a virtual function `f`, you can call
> `pv->f()`. With a conversion to T&, you can't call `pv.f()`.

I believe I've seen other libraries (maybe Optional) provide the helpful
comment above accessors used like this to the effect that 'this accessor
syntax does not imply pointer semantics.'
I guess -> and * accessors would not be required if there was such as thing
as overloaded dot operator.

Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost