[libcxx-commits] [PATCH] D111516: [libc++][docs] Mark LWG3274 as complete

Arthur O'Dwyer via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Mon Oct 11 10:15:11 PDT 2021


Quuxplusone added inline comments.


================
Comment at: libcxx/include/span:335
     _LIBCPP_INLINE_VISIBILITY constexpr size_type size_bytes() const noexcept { return _Extent * sizeof(element_type); }
-    _LIBCPP_INLINE_VISIBILITY constexpr bool empty()           const noexcept { return _Extent == 0; }
+    [[nodiscard]] _LIBCPP_INLINE_VISIBILITY constexpr bool empty() const noexcept { return _Extent == 0; }
 
----------------
jloser wrote:
> Mordante wrote:
> > Since the block was manually aligned it would be nice to keep it that way.
> With adding `[[nodiscard]]` it won't be aligned with `size()` and `size_bytes()` member function. So, we can either manually align those, or not align `empty()` member function. I chose the latter. WDYT?
Yeah, I think @mordante was asking for
```
    _LIBCPP_INLINE_VISIBILITY constexpr size_type size()           const noexcept { return _Extent; }
    _LIBCPP_INLINE_VISIBILITY constexpr size_type size_bytes()     const noexcept { return _Extent * sizeof(element_type); }
    [[nodiscard]] _LIBCPP_INLINE_VISIBILITY constexpr bool empty() const noexcept { return _Extent == 0; }
```
FWIW, I think it's fine either way, and would err on the side of the smaller diff (as you did) myself, but I don't care.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D111516



More information about the libcxx-commits mailing list