Преглед изворни кода

Move + and * operators of MoveOnly into MoveOnly.h.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@321852 91177308-0d34-0410-b5e6-96231b3b80d8
Billy Robert O'Neal III пре 7 година
родитељ
комит
4dd943ec8e

+ 0 - 10
test/std/numerics/numeric.ops/transform.reduce/transform_reduce_iter_iter_iter_init.pass.cpp

@@ -58,16 +58,6 @@ void test_return_type()
                        decltype(std::transform_reduce(p, p, p, Init{}))> );
 }
 
-inline MoveOnly operator+(const MoveOnly& lhs, const MoveOnly& rhs)
-{
-    return MoveOnly{lhs.get() + rhs.get()};
-}
-
-inline MoveOnly operator*(const MoveOnly& lhs, const MoveOnly& rhs)
-{
-    return MoveOnly{lhs.get() * rhs.get()};
-}
-
 void test_move_only_types()
 {
     MoveOnly ia[] = {{1}, {2}, {3}};

+ 2 - 1
test/support/MoveOnly.h

@@ -19,7 +19,6 @@
 
 class MoveOnly
 {
-    friend class MoveOnly2;
     MoveOnly(const MoveOnly&);
     MoveOnly& operator=(const MoveOnly&);
 
@@ -35,6 +34,8 @@ public:
 
     bool operator==(const MoveOnly& x) const {return data_ == x.data_;}
     bool operator< (const MoveOnly& x) const {return data_ <  x.data_;}
+    MoveOnly operator+(const MoveOnly& x) const { return MoveOnly{data_ + x.data_}; }
+    MoveOnly operator*(const MoveOnly& x) const { return MoveOnly{data_ * x.data_}; }
 };
 
 namespace std {