C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Way to get rid of valueless_by_exception in std::variant

From: Thiago Macieira <thiago_at_[hidden]>
Date: Tue, 28 Oct 2025 06:59:51 -0700
On Tuesday, 28 October 2025 05:59:12 Pacific Daylight Time Sebastian Wittmeier
via Std-Proposals wrote:
> No, the memory can be used to communicate with the hardware or special flags
> (e.g. non-pageable) were assigned with the help of the operating system.

I don't think that's a valid use of std::variant. What you're saying is true
for some user-provided type, but I don't see how it could apply to
std::variant, for two reasons:

1) the user should not know the layout of std::variant, and thus how reading
it or writing to it actually performs HW operations

2) by definition, a std::variant could contain other types instead, which make
even less sense in special memory.

-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
  Principal Engineer - Intel Data Center Group

Received on 2025-10-28 13:59:53