[libcxx-commits] [PATCH] D110503: [libc++] Implement P1394r4 for span: range constructor

Arthur O'Dwyer via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Mon Sep 27 21:01:28 PDT 2021


Quuxplusone added inline comments.


================
Comment at: libcxx/test/std/containers/views/span.cons/simple_range.h:4
+template <class T, size_t Size>
+struct SimpleRange {
+    constexpr T *data() {
----------------
jloser wrote:
> Quuxplusone wrote:
> > Once you convert `range.fail.cpp` to a bunch of static_asserts, you'll be using `SimpleRange` in only one file, and then it won't need its own header, so this comment will be moot.
> > 
> > If this class isn't scoped to a single test, then it should have a descriptive name like `SimpleContiguousNonborrowedRange`... which is just `std::vector`, isn't it? What's the point of making our own type here at all?
> Its new use in `range.pass.cpp` will be that we can have our `test()` function be usable in a `constexpr` context since `std::vector` isn't fully `constexpr` yet.
Makes sense, but for that, you might be able to get away with either `int[10]` or `std::array<int,10>` or `libcxx/test/support/test_constexpr_container.h` (which right now is used only in the `back_inserter` tests IIRC).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D110503



More information about the libcxx-commits mailing list