On Tue, 12 Sept 2023, 01:21 Ken Matsui via Libstdc++, wrote: > This patch optimizes the performance of the is_scoped_enum trait > by dispatching to the new __is_scoped_enum built-in trait. > OK for trunk (after the built-in is in the front end), thanks. > libstdc++-v3/ChangeLog: > > * include/std/type_traits (is_scoped_enum): Use > __is_scoped_enum built-in trait. > (is_scoped_enum_v): Likewise. > > Signed-off-by: Ken Matsui > --- > libstdc++-v3/include/std/type_traits | 12 ++++++++++++ > 1 file changed, 12 insertions(+) > > diff --git a/libstdc++-v3/include/std/type_traits > b/libstdc++-v3/include/std/type_traits > index 677cd934b94..26ae491fa69 100644 > --- a/libstdc++-v3/include/std/type_traits > +++ b/libstdc++-v3/include/std/type_traits > @@ -3585,6 +3585,12 @@ template _Args> > /// True if the type is a scoped enumeration type. > /// @since C++23 > > +# if _GLIBCXX_USE_BUILTIN_TRAIT(__is_scoped_enum) > + template > + struct is_scoped_enum > + : bool_constant<__is_scoped_enum(_Tp)> > + { }; > +# else > template > struct is_scoped_enum > : false_type > @@ -3596,11 +3602,17 @@ template _Args> > struct is_scoped_enum<_Tp> > : bool_constant > { }; > +# endif > > /// @ingroup variable_templates > /// @since C++23 > +# if _GLIBCXX_USE_BUILTIN_TRAIT(__is_scoped_enum) > + template > + inline constexpr bool is_scoped_enum_v = __is_scoped_enum(_Tp); > +# else > template > inline constexpr bool is_scoped_enum_v = is_scoped_enum<_Tp>::value; > +# endif > #endif > > #ifdef __cpp_lib_reference_from_temporary // C++ >= 23 && > ref_{converts,constructs}_from_temp > -- > 2.42.0 > >