| 1 |
|
|---|
| 2 | #include <boost/tr1/functional.hpp>
|
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 | struct my_key {
|
|---|
| 6 | int m_i;
|
|---|
| 7 | my_key() : m_i(0){};
|
|---|
| 8 |
|
|---|
| 9 | bool operator==(const my_key &rhs) const
|
|---|
| 10 | { return m_i == rhs.m_i; }
|
|---|
| 11 | operator std::size_t () const
|
|---|
| 12 | { return m_i; }
|
|---|
| 13 | };
|
|---|
| 14 |
|
|---|
| 15 | #ifdef BOOST_HAS_TR1_HASH
|
|---|
| 16 | namespace std {
|
|---|
| 17 | namespace tr1 {
|
|---|
| 18 | #else
|
|---|
| 19 | namespace boost {
|
|---|
| 20 | #endif // def BOOST_HAS_TR1_HASH
|
|---|
| 21 | template<>
|
|---|
| 22 | struct hash<my_key>
|
|---|
| 23 | {
|
|---|
| 24 | std::size_t operator()(const my_key& r) const
|
|---|
| 25 | { return (std::size_t)r; }
|
|---|
| 26 | };
|
|---|
| 27 |
|
|---|
| 28 | #ifdef BOOST_HAS_TR1_HASH
|
|---|
| 29 | } // namespace tr1
|
|---|
| 30 | } // namespace std
|
|---|
| 31 | #else
|
|---|
| 32 | } // namespace boost
|
|---|
| 33 | #endif // def BOOST_HAS_TR1_HASH
|
|---|
| 34 |
|
|---|
| 35 | int main()
|
|---|
| 36 | {
|
|---|
| 37 | return 0;
|
|---|
| 38 | }
|
|---|