diff --git a/include/mapnik/value.hpp b/include/mapnik/value.hpp index dc64ab609..6fdca6583 100644 --- a/include/mapnik/value.hpp +++ b/include/mapnik/value.hpp @@ -937,6 +937,12 @@ operator << (std::basic_ostream& out, return out; } +// hash function +inline std::size_t hash_value(value const& val) +{ + return hash_value(val); +} + } // namespace value_adl_barrier using value_adl_barrier::value; diff --git a/tests/cpp_tests/conversions_test.cpp b/tests/cpp_tests/conversions_test.cpp index 6f750840a..cb9d0d4fd 100644 --- a/tests/cpp_tests/conversions_test.cpp +++ b/tests/cpp_tests/conversions_test.cpp @@ -1,9 +1,11 @@ #include +#include #include #include #include #include #include +#include #if defined(_MSC_VER) && _MSC_VER < 1900 #include @@ -282,6 +284,14 @@ int main(int argc, char** argv) BOOST_TEST_EQ( val, false ); BOOST_TEST( string2bool("true",val) ); BOOST_TEST_EQ( val, true ); + + // mapnik::value hashability + using values_container = boost::unordered_map; + values_container vc; + mapnik::value val2(1); + vc[val2] = 1; + BOOST_TEST_EQ( vc[1], 1 ); + } catch (std::exception const & ex) {