Replace the _TC class template with the better-named _TupleConstraints one, which provides a different set of member functions. The new members do not distinguish construction from lvalues and rvalues, but expects the caller to do that by providing different template arguments. Within the std::tuple primary template and std::tuple
We now have:
There are two semantic changes as a result of the refactoring:
- The allocator-extended default constructor is now constrained.
- The rewritten constraints fix PR 90700.
- include/std/tuple (_TC): Replace with _TupleConstraints. (_TupleConstraints): New helper for SFINAE constraints, with more expressive member functions to reduce duplication when used. (tuple::_TC2, tuple::_TMC, tuple::_TNTC): Remove. (tuple::_TCC): Replace dummy type parameter with bool non-type parameter that can be used to check the pack size. (tuple::_ImplicitDefaultCtor, tuple::_ExplicitDefaultCtor) (tuple::_ImplicitCtor, tuple::_ExplicitCtor): New alias templates for checking constraints in constructors. (tuple::__valid_args, tuple::_UseOtherCtor, tuple::__use_other_ctor): New SFINAE helpers. (tuple::tuple): Use new helpers to reduce repitition in constraints. (tuple::tuple(allocator_arg_t, const Alloc&)): Constrain. (tuple
- testsuite/20_util/tuple/cons/90700.cc: New test.
- testsuite/20_util/tuple/cons/allocators.cc: Add default constructor to meet new constraint on allocator-extended default constructor.
42c1dacdb12 Refactor SFINAE constraints on std::tuple constructors
libstdc++-v3/ChangeLog | 27 +
libstdc++-v3/include/std/tuple | 900 +++++++++------------
libstdc++-v3/testsuite/20_util/tuple/cons/90700.cc | 66 ++
.../testsuite/20_util/tuple/cons/allocators.cc | 17 +-
4 files changed, 492 insertions(+), 518 deletions(-)