[libcxx-commits] [PATCH] D102468: [libcxx][ranges] makes `basic_string_view` and `span` satisfy concept view

Arthur O'Dwyer via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Thu Jun 10 08:15:38 PDT 2021


Quuxplusone accepted this revision.
Quuxplusone added a comment.

LGTM % comments.



================
Comment at: libcxx/include/CMakeLists.txt:52-53
   __ranges/empty_view.h
+  __ranges/enable_view.h
   __ranges/enable_borrowed_range.h
   __ranges/view_interface.h
----------------
Alphabetize plz


================
Comment at: libcxx/include/__ranges/concepts.h:16
 #include <__ranges/size.h>
+#include <__ranges/enable_view.h>
 #include <type_traits>
----------------
Alphabetize plz


================
Comment at: libcxx/include/__ranges/enable_view.h:10-11
 
 #ifndef _LIBCPP___RANGES_VIEW_H
 #define _LIBCPP___RANGES_VIEW_H
 
----------------
Update plz


================
Comment at: libcxx/include/span:536-537
 #if !defined(_LIBCPP_HAS_NO_RANGES)
+template <class _ElementType, size_t _Extent>
+inline constexpr bool ranges::enable_view<span<_ElementType, _Extent>> = _Extent == 0 || _Extent == dynamic_extent;
+
----------------
Quuxplusone wrote:
> Ditto here:
> ```
> template<class _Tp, size_t _Extent>
> inline constexpr bool ranges::enable_view<span<_Tp, _Extent>> =
>   (_Extent == 0 || _Extent == dynamic_extent);
> ```
bump


================
Comment at: libcxx/test/std/strings/string.view/range_concept_conformance.compile.pass.cpp:25
 static_assert(stdr::random_access_range<std::string_view>);
-static_assert(!stdr::view<std::string_view>);
+static_assert(stdr::view<std::string_view>&& stdr::enable_view<std::string_view>);
 static_assert(stdr::sized_range<std::string_view>);
----------------
> Missing space between > and && (elsewhere too).

namely, here


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D102468



More information about the libcxx-commits mailing list