Slides for P3740R1
Last chance to fix std :: nontype
- Document number:
- P3753R1
- Date:
2025-06-20 - Audience:
- LEWG
- Project:
- ISO/IEC 14882 Programming Languages — C++, ISO/IEC JTC1/SC22/WG21
- Reply-To:
- Jan Schultke <janschultke@gmail.com>
- Source:
- github.com/Eisenwave/cpp-proposals/blob/master/src/nontype-slides.cow
- →, ↓ : go to the next slide
- ←, ↑ : go to previous slide
Last chance
to fix std :: nontype
P3740R1
Introduction
- P2472R3 added
constructors forstd :: nontype std :: function_ref - merged into P0792R14, plenary-approved Varna 2023 for C++26
possibly obsoleted bystd :: nontype
(P2781R9)std :: constant_wrapper - Wording review completed by LWG
- "non-type template parameter" term was removed by P2841R1 (C++26)
Conclusion
History is messy.
may be a bad feature now,
or at least have a terrible name.
std :: function_ref
refresher
is a "function wrapper"
similar to
,
,
, but without ownership.
stores:
—bound-entity
(basically aBoundEntityType
)cv void *
—thunk-ptr R ( * ) ( BoundEntityType , Args ... ) noex
,
,
.
std :: nontype
in std :: function_ref
With std :: constant_wrapper
Alternatives considered
- Low consensus:
constructor tagstd :: stateless - remove
, revisit in C++29std :: nontype - wait for P1045R1
function parametersconstexpr - expose the
BoundEntityType
- Plausible:
- replace
withstd :: nontype std :: constant_wrapper - rename
(tostd :: nontype
)std :: constant_arg
- replace
std :: constant_wrapper
concerns
already behaves much like wrapped function:
andF &&
constructors are candidatesF * - not a problem, these lose in overload resolution
- danger of inconsistent behavior with
etc.std :: move_only_function
- Solution: Provide corresponding overloads for all function wrappers.
- Urgency: If done later, meaning of existing code sublty changed.