[libcxx-commits] [PATCH] D97443: [libcxx] adds concept std::copyable

Christopher Di Bella via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Wed Mar 10 13:42:31 PST 2021


cjdb added inline comments.


================
Comment at: libcxx/test/std/concepts/object/copyable.h:53
+  operator=(volatile_copy_assignment const&) volatile;
+};
+
----------------
Quuxplusone wrote:
> This naming convention implies more structure than you really have here. I think `struct X` might be a better name for this particular grab-bag of special member signatures.
> Alternatively, it might arguably be important to test some type that //is copyable// but volatile-qualified. In that case, I think the minimal set of SMFs that makes the type //actually// copyable would be
> https://godbolt.org/z/8affTh
> ```
> struct volatile_copy_assignment {
>   volatile_copy_assignment(volatile_copy_assignment const volatile&);
>   volatile_copy_assignment(volatile_copy_assignment const volatile&&);
> 
>   volatile_copy_assignment volatile& operator=(volatile_copy_assignment const volatile&) volatile;
>   volatile_copy_assignment volatile& operator=(volatile_copy_assignment const volatile&&) volatile;
> };
> ```
> (It's trickier than it sounds at first glance, because even though an `X&&` argument binds to a `const X&` parameter, yet a `volatile X&&` argument does //not// bind to a `const volatile X&` parameter.)
Isn't that what `cv_copy_assignment` does below?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D97443



More information about the libcxx-commits mailing list