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
17 Emplaceable(const Emplaceable
&);
18 Emplaceable
& operator=(const Emplaceable
&);
23 Emplaceable() : int_(0), double_(0) {}
24 Emplaceable(int i
, double d
) : int_(i
), double_(d
) {}
25 Emplaceable(Emplaceable
&& x
)
26 : int_(x
.int_
), double_(x
.double_
)
27 {x
.int_
= 0; x
.double_
= 0;}
28 Emplaceable
& operator=(Emplaceable
&& x
)
29 {int_
= x
.int_
; x
.int_
= 0;
30 double_
= x
.double_
; x
.double_
= 0;
33 bool operator==(const Emplaceable
& x
) const
34 {return int_
== x
.int_
&& double_
== x
.double_
;}
35 bool operator<(const Emplaceable
& x
) const
36 {return int_
< x
.int_
|| (int_
== x
.int_
&& double_
< x
.double_
);}
38 int get() const {return int_
;}
44 struct hash
<Emplaceable
>
45 : public std::unary_function
<Emplaceable
, std::size_t>
47 std::size_t operator()(const Emplaceable
& x
) const {return x
.get();}
52 #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
54 #endif // EMPLACEABLE_H