[libcxx-commits] [PATCH] D118502: [libcxx][test] Use = delete in libcxx/test/support/MoveOnly.h
Joe Loser via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Fri Jan 28 11:43:58 PST 2022
jloser updated this revision to Diff 404116.
jloser retitled this revision from "[libcxx][test] Use = delete in libcxx/test/suppor/MoveOnly.h" to "[libcxx][test] Use = delete in libcxx/test/support/MoveOnly.h".
jloser added a comment.
Fix type in git one-liner
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D118502/new/
https://reviews.llvm.org/D118502
Files:
libcxx/test/support/MoveOnly.h
Index: libcxx/test/support/MoveOnly.h
===================================================================
--- libcxx/test/support/MoveOnly.h
+++ libcxx/test/support/MoveOnly.h
@@ -18,9 +18,6 @@
class MoveOnly
{
- MoveOnly(const MoveOnly&);
- MoveOnly& operator=(const MoveOnly&);
-
int data_;
public:
constexpr MoveOnly(int data = 1) : data_(data) {}
@@ -29,6 +26,9 @@
TEST_CONSTEXPR_CXX14 MoveOnly& operator=(MoveOnly&& x)
{data_ = x.data_; x.data_ = 0; return *this;}
+ MoveOnly(const MoveOnly&) = delete;
+ MoveOnly& operator=(const MoveOnly&) = delete;
+
constexpr int get() const {return data_;}
friend constexpr bool operator==(const MoveOnly& x, const MoveOnly& y)
@@ -53,18 +53,15 @@
friend void operator,(T t, U u) = delete;
};
-namespace std {
template <>
-struct hash<MoveOnly>
+struct std::hash<MoveOnly>
{
typedef MoveOnly argument_type;
typedef size_t result_type;
constexpr size_t operator()(const MoveOnly& x) const {return x.get();}
};
-}
-
#endif // TEST_STD_VER >= 11
#endif // MOVEONLY_H
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D118502.404116.patch
Type: text/x-patch
Size: 1097 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20220128/d48ce045/attachment.bin>
More information about the libcxx-commits
mailing list