Date: Tue, 1 Mar 2022 16:23:27 +0100
On 01/03/2022 16:12, Nikolay Mihaylov via Std-Proposals wrote:
>
> >>> That makes it possible to use a random pointer with `std::get`.
> Yes, is this bad?
>
It's "bad" in the sense that get() (and the tuple protocol, in general)
is designed to work on things that you can destructure at compile time.
In other words, you statically know into how many elements to
destructure (tuple_size), the type of each element (tuple_element), and
the value of each element (get). Extending get() to unbounded types
(arrays, vectors, dynamic spans, you name it) is outside of its intended
use case.
(This actually raises the question as of why a span of fixed extent
doesn't implement the tuple protocol (P2116).)
My 2 c,
>
> >>> That makes it possible to use a random pointer with `std::get`.
> Yes, is this bad?
>
It's "bad" in the sense that get() (and the tuple protocol, in general)
is designed to work on things that you can destructure at compile time.
In other words, you statically know into how many elements to
destructure (tuple_size), the type of each element (tuple_element), and
the value of each element (get). Extending get() to unbounded types
(arrays, vectors, dynamic spans, you name it) is outside of its intended
use case.
(This actually raises the question as of why a span of fixed extent
doesn't implement the tuple protocol (P2116).)
My 2 c,
-- Giuseppe D'Angelo | giuseppe.dangelo_at_[hidden] | Senior Software Engineer KDAB (France) S.A.S., a KDAB Group company Tel. France +33 (0)4 90 84 08 53, http://www.kdab.com KDAB - The Qt, C++ and OpenGL Experts
Received on 2022-03-01 15:23:33