[libcxx-commits] [PATCH] D103487: [libcxx][ranges] Add `default_sentinel` and `default_sentinel_t`.
Arthur O'Dwyer via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Jun 1 13:58:36 PDT 2021
Quuxplusone added inline comments.
================
Comment at: libcxx/test/std/iterators/predef.iterators/default.sentinel/default.sentinel.pass.cpp:24
+
+ static_assert(std::same_as<decltype(std::default_sentinel), const std::default_sentinel_t>);
+
----------------
zoecarver wrote:
> Quuxplusone wrote:
> > I'd also like to see here that
> > ```
> > std::default_sentinel_t s1;
> > auto s2 = std::default_sentinel_t{};
> > (void)s1;
> > (void)s2;
> > ```
> > both compile. (C++20 seems to require that these compile. Unlike some types, e.g. `std::nullopt_t`, which are //not// supposed to default-construct.)
> Doesn't semiregular check that? Or is this a default constructible vs default initializable thing?
If we don't know, that's a great reason to add the test. :)
The snippet I suggested will test both "default initialization" (s1) and "construction from nothing" (s2).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D103487/new/
https://reviews.llvm.org/D103487
More information about the libcxx-commits
mailing list