C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Extension to runtime polymorphism proposed

From: Bjorn Reese <breese_at_[hidden]>
Date: Sat, 4 Apr 2026 15:32:50 +0200
On 4/4/26 08:59, Sebastian Wittmeier via Std-Proposals wrote:
> The problem seems to be
>
> {a, b, c}.select(k).op(...)
>
> - {a, b, c} is something like a std::variant - can be of different
> types out of a provided list of types (closed set, not open set / std::any)

It is a heterogeneous collection, so it is more like std::tuple.

> - there is a way to get which type to use or which type it is. Would
> also work, if b and c is the same type with different operations, as
> long as select can distinguish between b and c
>
> - the types neither have a common interface with the same method
> signature / syntax (as can be used from a template), nor a common
> ancestor or descendent in an inheritance hierarchy
>
> - certain operations should be called on those types. What exactly is
> called can differ between the selected types

Received on 2026-04-04 13:32:54