Boost logo

Boost :

From: Robert Ramey (ramey_at_[hidden])
Date: 2019-07-04 05:00:59


On 7/3/19 12:40 PM, Andrey Semashev via Boost wrote:
> On 7/3/19 7:42 PM, Robert Ramey via Boost wrote:
>>
>> The policy based design is an implement technique to specify the set
>> of legitimate variations of a design which the user might need without
>> the need to write multiple types.  Right now we have:
>>
>> boost::variant
>> std::variant
>> boost::variant2
>> boost::outcome
>> ?::expected
>> boost::optional
>> std::optional
>> ... ?
>>
>> Each one of these is a hodgepodge of design decisions arrived at after
>> very, very, very long speculative discussion.  That are really all
>> just special cases of the the concept of "typesafe variant".
>
> We've already had this discussion, and I'll reiterate that these types
> are not merely special cases - they serve their specific purposes and
> have interfaces and behavior tailored for their respective uses.

To me, it's just about code reuse. The class with the policies contains
all the variations for different features. The aliases just select
which features are to be used.

Now, it's hard to know whether or not this would result of a
simplification or more complexity without actually undertaking the work.
This would have to start with reviewing all the variant types above and
the documentation and likely the commentary about them. It's a big job.
Until that happens, whether or not it's an effective idea or not is just
speculation.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk