C++ Logo

std-proposals

Advanced search

Re: [std-proposals] [DRAFT PAPER] std::variant with std::specify_base

From: Zhihao Yuan <zy_at_[hidden]>
Date: Fri, 16 Sep 2022 18:16:15 +0000
On Friday, September 16th, 2022 at 5:47 AM, Bengt Gustafsson via Std-Proposals <std-proposals_at_[hidden]> wrote:


> I feel that it is a kludge to use variant for this purpose, where the
> aim is to store an instance of a subclass in a potentially open set of
> subclasses.
>

> This is better served by something like polymorphic_value [...]
>


polymorphic_value is for an open set
of subtypes, and the std::variant
solution here is for a closed set of
subtypes. They are of different purposes.
The latter is a kludge, but the codes
in transition are physically divergent,
while a design is meant to work well in
a complex environment.

--
Zhihao Yuan, ID lichray
The best way to predict the future is to invent it.
_______________________________________________

Received on 2022-09-16 18:16:22