[libcxx-commits] [PATCH] D102135: [libcxx][ranges] adds _`copyable-box`_

Tim Song via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Thu Jul 1 21:08:18 PDT 2021


tcanens added inline comments.


================
Comment at: libcxx/include/__ranges/copyable_box.h:75
+
+    constexpr __copyable_box& operator=(__copyable_box&& __other)
+      noexcept(is_nothrow_move_constructible_v<_Tp>)
----------------
It's possible for a `movable` type to use the primary template, so it also needs a

```
__copyable_box& operator=(__copyable_box&& __other) requires movable<_Tp> = default;
```


================
Comment at: libcxx/include/__ranges/copyable_box.h:130-131
+    // Implementation of assignment operators in case we perform optimization (1)
+    constexpr __copyable_box& operator=(__copyable_box const&) requires copyable<_Tp> = default;
+    constexpr __copyable_box& operator=(__copyable_box&&) requires movable<_Tp> = default;
+
----------------
The `constexpr` should be removed - on defaulted functions, an explicit `constexpr` is an assertion of constexpr-ness.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D102135



More information about the libcxx-commits mailing list