Boost logo

Boost :

Subject: [boost] Array in Unordered Map
From: Olaf van der Spek (ml_at_[hidden])
Date: 2012-04-30 13:12:53


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?


#include <array>
#include <boost/unordered_map.hpp>

namespace boost
        template<class T, size_t N>
        size_t hash_value(const std::array<T, N>& v)
                return boost::hash_range(v.begin(), v.end());

int main()
        boost::unordered_map<std::array<char, 20>, int> c;
        c[std::array<char, 20>()] = 0;
        return 0;


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