]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
libstdc++: Reorder constraints on std::span::span(Range&&) constructor.
authorJonathan Wakely <jwakely@redhat.com>
Mon, 1 Nov 2021 11:32:39 +0000 (11:32 +0000)
committerJonathan Wakely <jwakely@redhat.com>
Tue, 26 Apr 2022 11:07:40 +0000 (12:07 +0100)
In PR libstdc++/103013 Tim Song pointed out that we could reorder the
constraints of this constructor. That's worth doing just to reduce the
work the compiler has to do during overload resolution, even if it isn't
needed to make the code in the PR work.

libstdc++-v3/ChangeLog:

* include/std/span (span(Range&&)): Reorder constraints.

(cherry picked from commit 09bc98098e4ad474d2ba9da52457b29bbd08874b)

libstdc++-v3/include/std/span

index 4173446d141934f1aa502a55c11cc12ca84e5b6b..4b389a46af7bc3257e72bb8f4a754542cb022e45 100644 (file)
@@ -204,11 +204,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
        { }
 
       template<typename _Range>
-       requires ranges::contiguous_range<_Range> && ranges::sized_range<_Range>
-         && (ranges::borrowed_range<_Range> || is_const_v<element_type>)
-         && (!__detail::__is_std_span<remove_cvref_t<_Range>>::value)
+       requires (!__detail::__is_std_span<remove_cvref_t<_Range>>::value)
          && (!__detail::__is_std_array<remove_cvref_t<_Range>>::value)
          && (!is_array_v<remove_cvref_t<_Range>>)
+         && ranges::contiguous_range<_Range> && ranges::sized_range<_Range>
+         && (ranges::borrowed_range<_Range> || is_const_v<element_type>)
          && __is_compatible_ref<ranges::range_reference_t<_Range>>::value
        constexpr explicit(extent != dynamic_extent)
        span(_Range&& __range)