Boost logo

Boost :

Subject: Re: [boost] Array in Unordered Map
From: Daniel James (dnljms_at_[hidden])
Date: 2012-04-30 16:11:14

On 30 April 2012 18:12, Olaf van der Spek <ml_at_[hidden]> wrote:
> Hi,
> What's the right way to get an array into an unordered map?
> This one works on VC10, but GCC appears to look for the hash_value
> function in namespace std.
> What's the right way to do this?

As far as I know gcc is correct. Functions are only visible if they're
available at the point of the call to hash_value in the source code,
or via ADL at the point of instantiation. So you need to do one of: a)
write hash_value before including the hash header, b) write hash_value
in the std namespace, c) specialize boost::hash, d) use trunk, which
supports std::array or e) patch your copy of boost. 'a' is pretty
fragile, 'b' isn't standards compliant, 'd' and 'e' might not be
possible so 'c' is possibly the best thing to do - it also won't clash
with boost::hash_value when boost 1.50 is released. Specializing
boost::hash isn't really recommended in general, but if there's no
other solution...

Boost list run by bdawes at, gregod at, cpdaniel at, john at