[libcxx-commits] [PATCH] D121626: [libc++] Add workaround to avoid breaking users of <span> when <ranges> are disabled

Joe Loser via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Mon Mar 14 16:33:34 PDT 2022


jloser added a comment.

Seems reasonable to me. I left a nit, but do we also need to restore support for deduction guides in the incomplete ranges case? E.g., prior to the range constructor, we had:

  template<class _Container>
      span(_Container&) -> span<typename _Container::value_type>;
  
  template<class _Container>
      span(const _Container&) -> span<const typename _Container::value_type>;

If so, please add them back along with associated tests.



================
Comment at: libcxx/include/span:275
+    _LIBCPP_INLINE_VISIBILITY
+    constexpr explicit span(_Container const& __c) : __data{std::data(__c)} {
+      _LIBCPP_ASSERT(std::size(__c) == _Extent, "size mismatch in span's constructor (range)");
----------------
Nit: I think we (mostly) use west-const everywhere, right? So, `s/_Container const/const _Container/g` for example.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D121626



More information about the libcxx-commits mailing list