Ticket #5254: TR1_hash_break.cpp
| File TR1_hash_break.cpp, 473 bytes (added by , 12 years ago) |
|---|
| Line | |
|---|---|
| 1 | |
| 2 | #include <boost/tr1/functional.hpp> |
| 3 | |
| 4 | struct my_key { |
| 5 | int m_i; |
| 6 | my_key() : m_i(0){}; |
| 7 | |
| 8 | bool operator==(const my_key &rhs) const |
| 9 | { return m_i == rhs.m_i; } |
| 10 | operator std::size_t () const |
| 11 | { return m_i; } |
| 12 | }; |
| 13 | |
| 14 | namespace std { |
| 15 | namespace tr1 { |
| 16 | template<> |
| 17 | struct hash<my_key> |
| 18 | { |
| 19 | std::size_t operator()(const my_key& r) const |
| 20 | { return (std::size_t)r; } |
| 21 | }; |
| 22 | |
| 23 | } // namespace tr1 |
| 24 | } // namespace std |
| 25 | |
| 26 | |
| 27 | int main() |
| 28 | { |
| 29 | return 0; |
| 30 | } |
