[libcxx-commits] [PATCH] D98154: [libcxx] adds concept std::regular

Mark de Wever via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Wed Mar 10 11:00:12 PST 2021


Mordante added inline comments.


================
Comment at: libcxx/test/std/concepts/object/regular.compile.pass.cpp:75
+static_assert(std::regular<std::vector<std::unique_ptr<int> > >);
+static_assert(std::semiregular<std::in_place_t>);
+static_assert(!std::regular<std::in_place_t>);
----------------
Quuxplusone wrote:
> This line is out of place.
> It did strike me tonight that we could have organized these tests completely differently: we could have presented one //type// at a time, and static-asserted exactly where it falls on the concept hierarchy. For example:
> 
> ```
> struct Simple {};
> static_assert(std::semiregular<Simple> && !std::regular<Simple>);
> 
> struct MoveCtor { MoveCtor(MoveCtor&&); };
> static_assert(std::move_constructible<MoveCtor> && !std::movable<MoveCtor>);
> ```
> and so on.
Isn't this done to show the type is semiregular, but not regular? There are more of these "double tests". But I agree combining them might be better.


================
Comment at: libcxx/test/std/concepts/object/regular.compile.pass.cpp:120
+static_assert(std::is_copy_assignable_v<no_copy_assignment_mutable>);
+static_assert(!std::regular<no_copy_assignment_mutable>);
+static_assert(!std::regular<derived_from_noncopyable>);
----------------
Could these two also be combined?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D98154



More information about the libcxx-commits mailing list