[libcxx-commits] [PATCH] D71994: SFINAE span default constructor on Extent == 0

Eric Fiselier via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Wed Mar 11 20:21:40 PDT 2020


EricWF requested changes to this revision.
EricWF added a comment.
This revision now requires changes to proceed.
Herald added a reviewer: libc++.

Does this really need concepts?



================
Comment at: libcxx/include/span:211
 // [span.cons], span constructors, copy, assignment, and destructor
-    _LIBCPP_INLINE_VISIBILITY constexpr span() noexcept : __data{nullptr}
-    { static_assert(_Extent == 0, "Can't default construct a statically sized span with size > 0"); }
+    _LIBCPP_INLINE_VISIBILITY constexpr span() noexcept requires (_Extent == 0): __data{nullptr} {}
 
----------------
We don't use concepts anywhere else in the library. Why are you not using SFINAE instead?

What happens when you include this file when `requires` isn't supported?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D71994/new/

https://reviews.llvm.org/D71994





More information about the libcxx-commits mailing list