[libcxx-commits] [PATCH] D109212: [libc++][NFCI] span: replace enable_if with concepts

Louis Dionne via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Tue Jun 14 12:52:37 PDT 2022


ldionne accepted this revision.
ldionne added a comment.

LGTM with comment.



================
Comment at: libcxx/include/span:608
 auto as_writable_bytes(span<_Tp, _Extent> __s) noexcept
--> enable_if_t<!is_const_v<_Tp>, decltype(__s.__as_writable_bytes())>
+-> decltype(__s.__as_writable_bytes())
 { return __s.__as_writable_bytes(); }
----------------
jloser wrote:
> philnik wrote:
> > Is there a reason we don't just use `decltype(auto)` as the return type and drop the trailing return type completely?
> No reason. Just switched to `decltype(auto)` since we have existing use of that in `variant`, and some of ranges, etc.
I think it's actually confusing to use `decltype(auto)` here since it suggests that there's some value-category preservation going on, when there really is none. I would just use `auto` instead.


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