1 //===----------------------------------------------------------------------===//
3 // The LLVM Compiler Infrastructure
5 // This file is dual licensed under the MIT and the University of Illinois Open
6 // Source Licenses. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
13 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
20 MoveOnly(const MoveOnly&);
21 MoveOnly& operator=(const MoveOnly&);
25 MoveOnly(int data = 1) : data_(data) {}
26 MoveOnly(MoveOnly&& x)
27 : data_(x.data_) {x.data_ = 0;}
28 MoveOnly& operator=(MoveOnly&& x)
29 {data_ = x.data_; x.data_ = 0; return *this;}
31 int get() const {return data_;}
33 bool operator==(const MoveOnly& x) const {return data_ == x.data_;}
34 bool operator< (const MoveOnly& x) const {return data_ < x.data_;}
41 : public std::unary_function<MoveOnly, std::size_t>
43 std::size_t operator()(const MoveOnly& x) const {return x.get();}
48 #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES