1 //===----------------------------------------------------------------------===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
13 #include "test_macros.h"
15 #if TEST_STD_VER >= 11
19 Emplaceable(const Emplaceable
&);
20 Emplaceable
& operator=(const Emplaceable
&);
25 Emplaceable() : int_(0), double_(0) {}
26 Emplaceable(int i
, double d
) : int_(i
), double_(d
) {}
27 Emplaceable(Emplaceable
&& x
)
28 : int_(x
.int_
), double_(x
.double_
)
29 {x
.int_
= 0; x
.double_
= 0;}
30 Emplaceable
& operator=(Emplaceable
&& x
)
31 {int_
= x
.int_
; x
.int_
= 0;
32 double_
= x
.double_
; x
.double_
= 0;
35 bool operator==(const Emplaceable
& x
) const
36 {return int_
== x
.int_
&& double_
== x
.double_
;}
37 bool operator<(const Emplaceable
& x
) const
38 {return int_
< x
.int_
|| (int_
== x
.int_
&& double_
< x
.double_
);}
40 int get() const {return int_
;}
44 struct std::hash
<Emplaceable
> {
45 typedef Emplaceable argument_type
;
46 typedef std::size_t result_type
;
48 std::size_t operator()(const Emplaceable
& x
) const { return x
.get(); }
51 #endif // TEST_STD_VER >= 11
52 #endif // EMPLACEABLE_H