
On Mon, Apr 30, 2012 at 10:11 PM, Daniel James <dnljms@gmail.com> wrote:
On 30 April 2012 18:12, Olaf van der Spek <ml@vdspek.org> 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,
Are both VC10 and VC11 broken then?
or via ADL at the point of instantiation. So you need to do one of: a) write hash_value before including the hash header,
A bit hard, as I need hash_range().
b) write hash_value in the std namespace,
Doesn't work with VC10. c) specialize boost::hash, d) use trunk, which
supports std::array or
Not an option, the software should be compilable on Debian, CentOS, RHEL, etc.
e) patch your copy of boost.
See D
'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...
I'll give C a try, thanks. -- Olaf