]> git.ipfire.org Git - thirdparty/gcc.git/commit
libstdc++: Optimize constructible/assignable variable templates
authorJonathan Wakely <jwakely@redhat.com>
Thu, 1 Sep 2022 19:40:42 +0000 (20:40 +0100)
committerJonathan Wakely <jwakely@redhat.com>
Fri, 2 Sep 2022 15:57:49 +0000 (16:57 +0100)
commit45433832a1ec392814e7f1cb7559bca48c2cb4e0
tree1beb2273cd6b977aed67874d472e1f1150452def
parent51c42b38e43b5283b116882529d232719b099bfc
libstdc++: Optimize constructible/assignable variable templates

This defines the is_xxx_constructible_v and is_xxx_assignable_v variable
templates by using the built-ins directly. The actual logic for each one
is the same as the corresponding class template, but way using the
variable template doesn't need to instantiate the class template.

This means that the variable templates won't use the static assertions
checking for complete types, cv void or unbounded arrays, but that's OK
because the built-ins check those anyway. We could probably remove the
static assertions from the class templates, and maybe from all type
traits that use a built-in.

libstdc++-v3/ChangeLog:

* include/std/type_traits (is_constructible_v)
(is_default_constructible_v, is_copy_constructible_v)
(is_move_constructible_v): Define using __is_constructible.
(is_assignable_v, is_copy_assignable_v, is_move_assignable_v):
Define using __is_assignable.
(is_trivially_constructible_v)
(is_trivially_default_constructible_v)
(is_trivially_copy_constructible_v)
(is_trivially_move_constructible_v): Define using
__is_trivially_constructible.
(is_trivially_assignable_v, is_trivially_copy_assignable_v)
(is_trivially_move_assignable_v): Define using
__is_trivially_assignable.
(is_nothrow_constructible_v)
(is_nothrow_default_constructible_v)
(is_nothrow_copy_constructible_v)
(is_nothrow_move_constructible_v): Define using
__is_nothrow_constructible.
(is_nothrow_assignable_v, is_nothrow_copy_assignable_v)
(is_nothrow_move_assignable_v): Define using
__is_nothrow_assignable.
libstdc++-v3/include/std/type_traits