C++ Logo

std-proposals

Advanced search

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

From: Sebastian Wittmeier <wittmeier_at_[hidden]>
Date: Tue, 28 Oct 2025 15:32:35 +0100
Yes, but normally the constructors/destructors/move/copy are called, when the memory location changes. So the type has full control. It you backup during the lifetime without using the class member functions for a non-trivially movable type, this can run into problems.   -----Ursprüngliche Nachricht----- Von:Thiago Macieira via Std-Proposals <std-proposals_at_[hidden]> Gesendet:Di 28.10.2025 15:00 Betreff:Re: [std-proposals] Way to get rid of valueless_by_exception in std::variant Anlage:signature.asc An:std-proposals_at_[hidden]; CC:Thiago Macieira <thiago_at_[hidden]>; 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 -- Std-Proposals mailing list Std-Proposals_at_[hidden] https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals

Received on 2025-10-28 14:45:49