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

llvm-svn: 321852
This commit is contained in:
Billy Robert O'Neal III 2018-01-05 01:32:00 +00:00
parent 4958692ad9
commit 3770e403ee
2 changed files with 2 additions and 11 deletions

View File

@ -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}};

View File

@ -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 {