libstdc++: Remove redundant code in std::to_array

libstdc++-v3/ChangeLog:

	* include/std/array (to_array(T(&)[N])): Remove redundant
	condition.
	(to_array(T(&&)[N])): Remove redundant std::move.
This commit is contained in:
Jonathan Wakely 2023-06-20 09:27:04 +01:00
parent 649c640cc4
commit b4f1e4a644

View file

@ -426,7 +426,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
static_assert(is_constructible_v<_Tp, _Tp&>);
if constexpr (is_constructible_v<_Tp, _Tp&>)
{
if constexpr (is_trivial_v<_Tp> && _Nm != 0)
if constexpr (is_trivial_v<_Tp>)
{
array<remove_cv_t<_Tp>, _Nm> __arr;
if (!__is_constant_evaluated() && _Nm != 0)
@ -462,7 +462,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
__builtin_memcpy(__arr.data(), __a, sizeof(__a));
else
for (size_t __i = 0; __i < _Nm; ++__i)
__arr._M_elems[__i] = std::move(__a[__i]);
__arr._M_elems[__i] = __a[__i];
return __arr;
}
else