[libcxx-commits] [PATCH] D109212: [libc++] span: replace enable_if with requires. NFCI.
Arthur O'Dwyer via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Fri Sep 3 06:17:31 PDT 2021
Quuxplusone added inline comments.
================
Comment at: libcxx/include/span:221
// [span.cons], span constructors, copy, assignment, and destructor
- template <size_t _Sz = _Extent, enable_if_t<_Sz == 0, nullptr_t> = nullptr>
+ template <size_t _Sz = _Extent> requires(_Sz == 0)
_LIBCPP_INLINE_VISIBILITY constexpr span() noexcept : __data{nullptr} {}
----------------
> `enable_if_t` which is verbose and slow
I benchmarked `enable_if_t` versus `_EnableIf` versus `requires` over at https://reviews.llvm.org/D108216#inline-1037983 a couple days ago, and it seemed that `requires` was about 20% slower than `enable_if_t`/`_EnableIf`. What evidence led you to the "and slow" part of your comment?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D109212/new/
https://reviews.llvm.org/D109212
More information about the libcxx-commits
mailing list