forked from OSchip/llvm-project
Move + and * operators of MoveOnly into MoveOnly.h.
llvm-svn: 321852
This commit is contained in:
parent
4958692ad9
commit
3770e403ee
|
@ -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}};
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Reference in New Issue