Boost logo

Boost Users :

Subject: [Boost-users] [Graph] redefinition of hash<void*> clashes with boost/functional/hash.hpp
From: Ioannis Papadopoulos (ipapadop_at_[hidden])
Date: 2011-10-26 20:57:18


Hi,

In graph/detail/adjacency_list.hpp:2766 there is a specialization of
struct hash for void*. Isn't the generic pointer specialization in
functional/hash/extensions.hpp:172 enough?

The problem I am facing is the following (which I couldn't reproduce in
a trivial example):

1. I include <boost/functional/hash.hpp> and <boost/tr1/unordered_map.hpp>
2. I create an std::tr1::unordered_map<void*, int> and typedef
std::tr1::unordered_map<void*, int>::iterator iterator_type;
3. In some test file that includes <boost/graph/adjacency_list.hpp> and
uses it, I get the following error (gcc 4.4.5/4.6.1):
/usr/local/include/boost/graph/detail/adjacency_list.hpp:2766: error:
specialization of ¡boost::hash<void*>¢ after instantiation
/usr/local/include/boost/graph/detail/adjacency_list.hpp:2766: error:
redefinition of ¡struct boost::hash<void*>¢
/usr/local/usr/include/boost/functional/hash/extensions.hpp:172: error:
previous definition of ¡struct boost::hash<void*>¢

I can resolve it by providing my own hash functor to the unordered_map
(which causes hash<void*> not to be instantiated). I will keep trying to
provide a trivial example.

Thanks


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net