[libcxx-commits] [PATCH] D110503: [libc++] Implement P1394r4 for span: range constructor
Joe Loser via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Mon Sep 27 16:53:42 PDT 2021
jloser added inline comments.
================
Comment at: libcxx/test/std/containers/views/span.cons/iterator_len.pass.cpp:80-82
+ return
+ s1.data() == &val[0] && s1.size() == 2
+ && s2.data() == &val[0] && s2.size() == 2;
----------------
Quuxplusone wrote:
> ```
> T val[2] = {};
> auto s1 = std::span<T>(val, 2);
> auto s2 = std::span<T, 2>(val, 2);
> assert(s1.data() == &val[0] && s1.size() == 2);
> assert(s2.data() == &val[0] && s2.size() == 2);
> return true;
> ```
> The big things here are that you can use `assert` in constexpr functions, and that you //don't// mark variables `constexpr` inside constexpr functions. I assumed that the `const` in `const T` was not significant to what you were trying to test; otherwise you could bring it back.
> Probably you can collapse `testConstexprSpan` and `testRuntimeSpan` into the same function, now.
I like that much better -- thanks! Just applied your suggestion and collapsed the previous `testConstexprSpan` and `testRuntimeSpan`. Similarly in `iterator_iterator.pass.cpp`.
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