P3978R2 — constant_wrapper should unwrap on call and subscript
(3 items)
LEWG
This paper proposes adding unwrapping overloads of operator() and operator[] to std::constant_wrapper, making them static, and using INVOKE consistently in both the wrapping and unwrapping modes of the call operator. The design follows the principle that constant_wrapper should transparently unwrap into the value it holds unless all operands are constant_wrappers and the result can remain wrapped, achieving behavioral consistency with how other operators already work via ADL and the conversion operator. The paper also proposes moving constant_wrapper from to .
-
Section 3.2, page 4 — Text describes array
as an associated namespace. array is a class type; the associated namespace is std. Should refer to std as the associated namespace or to array as an associated class. [1]
References — Anthropic Citations API
[1]
"The subscript in #2 does not work because, even though array is an associated namespace and x is convertible to array, the array::operator[] member function is not found."
"The subscript in #2 does not work because, even though array
Summary: Proposes extending std::constant_wrapper so that its operator() and operator[] forward to the underlying wrapped value, enabling constant_wrapper objects to be called or subscripted directly when the wrapped value supports those operations.
Pipeline: Discovery (Anthropic Opus + Citations API) → Verification Gate (OpenRouter Opus) → Report Writer (OpenRouter Opus)
Provenance: All references are machine-verified character positions from the Anthropic Citations API — deterministic, exact substrings, not model-generated quotes.
Provenance: All references are machine-verified character positions from the Anthropic Citations API — deterministic, exact substrings, not model-generated quotes.