]> git.ipfire.org Git - thirdparty/gcc.git/commit
libstdc++: Add __is_in_place_index_v helper and use it in <variant>
authorJonathan Wakely <jwakely@redhat.com>
Fri, 22 Mar 2024 11:47:44 +0000 (11:47 +0000)
committerJonathan Wakely <jwakely@redhat.com>
Sat, 23 Mar 2024 11:07:57 +0000 (11:07 +0000)
commit3763fb8970d7515a4a3be2152604140965303031
tree8ca3631982c552413899fe206887f9f952469f8d
parentf4605c53ea2eeafc13e14dd1ad00a0caf80057e2
libstdc++: Add __is_in_place_index_v helper and use it in <variant>

We already have __is_in_place_type_v for in_place_type_t so adding an
equivalent for in_place_index_t allows us avoid a class template
instantiation for the __not_in_place_tag constraint on the most
commonly-used std::variant::variant(T&&) constructor.

For in_place_type_t we also have a __is_in_place_type class template
defined in terms of the variable template, but that isn't actually used
anywhere. I'm not adding an equivalent for the new variable template,
because that wouldn't be used either.

For GCC 15 we should remove the unused __is_in_place_tag and
__is_in_place_type class templates.

libstdc++-v3/ChangeLog:

* include/bits/utility.h (__is_in_place_index_v): New variable
template.
* include/std/variant (__not_in_place_tag): Define in terms of
variable templates not a class template.
libstdc++-v3/include/bits/utility.h
libstdc++-v3/include/std/variant