aab290a3160ad4d93e184e5d8835f6b457052ecb
[platform/framework/web/crosswalk.git] / src / third_party / libc++ / trunk / test / containers / Emplaceable.h
1 #ifndef EMPLACEABLE_H
2 #define EMPLACEABLE_H
3
4 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
5
6 class Emplaceable
7 {
8     Emplaceable(const Emplaceable&);
9     Emplaceable& operator=(const Emplaceable&);
10
11     int int_;
12     double double_;
13 public:
14     Emplaceable() : int_(0), double_(0) {}
15     Emplaceable(int i, double d) : int_(i), double_(d) {}
16     Emplaceable(Emplaceable&& x)
17         : int_(x.int_), double_(x.double_)
18             {x.int_ = 0; x.double_ = 0;}
19     Emplaceable& operator=(Emplaceable&& x)
20         {int_ = x.int_; x.int_ = 0;
21          double_ = x.double_; x.double_ = 0;
22          return *this;}
23
24     bool operator==(const Emplaceable& x) const
25         {return int_ == x.int_ && double_ == x.double_;}
26     bool operator<(const Emplaceable& x) const
27         {return int_ < x.int_ || (int_ == x.int_ && double_ < x.double_);}
28
29     int get() const {return int_;}
30 };
31
32 namespace std {
33
34 template <>
35 struct hash<Emplaceable>
36     : public std::unary_function<Emplaceable, std::size_t>
37 {
38     std::size_t operator()(const Emplaceable& x) const {return x.get();}
39 };
40
41 }
42
43 #endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
44
45 #endif  // EMPLACEABLE_H