On 19 November 2017 at 23:41,
Message: 12 Date: Mon, 20 Nov 2017 01:41:10 +0200 From: "Peter Dimov"
To: Subject: Re: [boost] Adding polymorphic_value to boost Message-ID: 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.