Remove building with NOCRYPTO option
[minix.git] / external / bsd / libc++ / dist / libcxx / test / containers / Emplaceable.h
blob34dd326203b0a0078a3092c60dec67621a58b8ee
1 //===----------------------------------------------------------------------===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is dual licensed under the MIT and the University of Illinois Open
6 // Source Licenses. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
10 #ifndef EMPLACEABLE_H
11 #define EMPLACEABLE_H
13 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
15 class Emplaceable
17 Emplaceable(const Emplaceable&);
18 Emplaceable& operator=(const Emplaceable&);
20 int int_;
21 double double_;
22 public:
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;
31 return *this;}
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_;}
41 namespace std {
43 template <>
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