C++ Logo

std-proposals

Advanced search

Re: [std-proposals] zero overhead for std::optional

From: Andrey Semashev <andrey.semashev_at_[hidden]>
Date: Sat, 04 Apr 2026 14:28:32 +0300
On April 4, 2026 1:56:39 PM Jonathan Wakely via Std-Proposals
<std-proposals_at_[hidden]> wrote:

> I only read the abstract, but how does changing the optional class template
> from one template parameter to two template parameters provide complete
> backwards compatibility? It means optional<X> has a different mangled name,
> and so it's an ABI break.

Unrelated to the proposal, but was it considered to decouple symbol
mangling from the language? For example, in this case optional<X> would
still be mangled as before while optional<X, Y> (for non-default Y) would
be mangled differently. This could be achieved with a vendor-specific
attribute. In terms of standardization, this would allow more extensions to
existing standard types.

Received on 2026-04-04 11:28:36