C++ Logo

std-proposals

Advanced search

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

From: Bjorn Reese <breese_at_[hidden]>
Date: Thu, 9 Apr 2026 17:45:14 +0200
On 4/9/26 14:54, Muneem via Std-Proposals wrote:

> The main point is that decentralized features always win because each
> focuses on one, right now, we are using metaprogramming for everything
> and it's a mess! (Look above!!)

Simon was suggesting subscript operator for std::tuple, which less messy
than building your own tuple type. See

   https://godbolt.org/z/x74E6x181

Simon also suggested that std::variant should be extended to support
references, so we can avoid copying.

Having said that, I do not believe that it is a good idea to make
std::tuple dependent on std::variant. As we have to use std::visit to
access the data inside the std::variant anyways, I prefer an extension
to std::visit (or a new function) that takes a visitor, a tuple-like
object, and an index. I have posted a proof of concept for this
elsewhere in this discussion.

Received on 2026-04-09 15:45:19