On Fri, 5 Sept 2025 at 08:14, Tomasz Kamiński <tkami...@redhat.com> wrote: > > From: Luc Grosheintz <luc.groshei...@gmail.com> > > This is a partial implementation of P2781R9. It adds std::cw and > std::constant_wrapper, but doesn't modify __integral_constant_like for > span/mdspan. > > libstdc++-v3/ChangeLog: > > * include/bits/version.def (constant_wrapper): Add. > * include/bits/version.h: Regenerate. > * include/std/type_traits (_CwFixedValue): New class. > (_IndexSequence): New struct. > (_BuildIndexSequence): New struct. > (_ConstExprParam): New concept. > (_CwOperators): New struct. > (constant_wrapper): New struct. > (cw): New global constant. > * src/c++23/std.cc.in (constant_wrapper): Add. > (cw): Add. > * testsuite/20_util/constant_wrapper/adl.cc: New test. > * testsuite/20_util/constant_wrapper/ex.cc: New test. > * testsuite/20_util/constant_wrapper/generic.cc: New test. > * testsuite/20_util/constant_wrapper/instantiate.cc: New test. > * testsuite/20_util/constant_wrapper/op_comma_neg.cc: New test. > * testsuite/20_util/constant_wrapper/version.cc: New test. > > Co-authored-by: Tomasz Kamiński <tkami...@redhat.com> > Signed-off-by: Luc Grosheintz <luc.groshei...@gmail.com> > Signed-off-by: Tomasz Kamiński <tkami...@redhat.com> > --- > v5 adds data member pointer tests
This adds a lot of new code to <type_traits> which needs to be preprocessed even by C++11/14/17/20/23 programs, so we might want to put it in a separate header that is included from <type_traits> conditionally: #ifdef __cpp_lib_constant_wrapper #include <bits/constant_wrapper.h> #endif but we can do that later, as splitting up <type_traits> is already planned (maybe we should look into that for GCC 16 during stage 3, when we're stabilising things). OK for trunk, thank you both for working on this.