
I'm having a hard time trying to compile my code here. What I'm doing is to overload the boost::hash_value function to use boost::unordered_map with a custom Vector2 class. My code: // Vector2 hash function namespace boost { inline std::size_t hash_value(Vector2 const& p) { std::size_t seed = 0; boost::hash_combine(seed, p.x); boost::hash_combine(seed, p.y); return seed; } } // namepace boost boost::unordered_map<Vector2, EntityList, boost::hash<Vector2> > buckets;[/code] It compiles and run fine on msvc 9.0 but gcc says the function does not exist (it looks like to me that it does exist!). error message: Compile++ thumb : Application <= BucketManager.cpp In file included from /boost/functional/hash/hash.hpp:510, from /boost/functional/hash.hpp:6, from /boost/unordered/unordered_map.hpp:17, from BucketManager.h:35, from BucketManager.cpp:24: /boost/functional/hash/extensions.hpp: In member function 'size_t boost::hash<T>::operator()(const T&) const [with T = math::Vector2]': /boost/unordered/detail/unique.hpp:183: instantiated from 'typename boost::unordered_detail::hash_unique_table<T>::value_type& boost::unordered_detail::hash_unique_table<T>::operator[](const typename T::key_type&) [with T = boost::unordered_detail::map<math::Vector2, boost::hash<math::Vector2>, std::equal_to<math::Vector2>, std::allocator<std::pair<const math::Vector2, std::list<RenderEntity*> > >
]' /boost/unordered/unordered_map.hpp:406: instantiated from 'T& boost::unordered_map<K, T, H, P, A>::operator[](const K&) [with K = math::Vector2, T = std::list<RenderEntity*>, H = boost::hash<math::Vector2>, P = std::equal_to<math::Vector2>, A = std::allocator<std::pair<const math::Vector2, std::list<RenderEntity*> > >]' BucketManager.cpp:128: instantiated from here /boost/functional/hash/extensions.hpp:176: error: no matching function for call to 'hash_value(const math::Vector2&)' /boost/functional/hash/hash.hpp:136: note: candidates are: size_t boost::hash_value(bool) /boost/functional/hash/hash.hpp:141: note: size_t boost::hash_value(char) /boost/functional/hash/hash.hpp:146: note: size_t boost::hash_value(unsigned char) /boost/functional/hash/hash.hpp:151: note: size_t boost::hash_value(signed char) /boost/functional/hash/hash.hpp:156: note: size_t boost::hash_value(short int) /boost/functional/hash/hash.hpp:161: note: size_t boost::hash_value(short unsigned int) /boost/functional/hash/hash.hpp:166: note: size_t boost::hash_value(int) /boost/functional/hash/hash.hpp:171: note: size_t boost::hash_value(unsigned int) /boost/functional/hash/hash.hpp:176: note: size_t boost::hash_value(long int) /boost/functional/hash/hash.hpp:181: note: size_t boost::hash_value(long unsigned int) /boost/functional/hash/hash.hpp:187: note: size_t boost::hash_value(wchar_t) /boost/functional/hash/hash.hpp:194: note: size_t boost::hash_value(boost::long_long_type) /boost/functional/hash/hash.hpp:199: note: size_t boost::hash_value(boost::ulong_long_type) /boost/functional/hash/hash.hpp:313: note: size_t boost::hash_value(float) /boost/functional/hash/hash.hpp:318: note: size_t boost::hash_value(double) /boost/functional/hash/hash.hpp:323: note: size_t boost::hash_value(long double) make: *** -- André Santee | Desenvolvedor de games andre.santee@jera.com.br | +55 67 8127-9528 [image: Facebook]<http://www.facebook.com/pages/Jera-Software-Agil/127079757331746> [image: Facebook] <http://twitter.com/decosantee> [image: Flickr]<http://www.flickr.com/jerasoftware> [image: LinkEdin] <http://www.linkedin.com/companies/jera?trk=fc_badge> <http://www.jera.com.br/>