Boost logo

Boost Users :

Subject: Re: [Boost-users] [Graph] redefinition of hash<void*> clashes with boost/functional/hash.hpp
From: Jeremiah Willcock (jewillco_at_[hidden])
Date: 2011-10-26 21:18:02


On Wed, 26 Oct 2011, Ioannis Papadopoulos wrote:

> 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.

I have removed that from the trunk (boost::hash always provides that
specialization now). See if that helps (if you don't want to get the
trunk version, the only change is removing the hash<void*> part of
boost/graph/detail/adjacency_list.hpp).

-- Jeremiah Willcock


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