restore value hash + add test harness
This commit is contained in:
parent
41e07e3083
commit
25a41ae31b
2 changed files with 16 additions and 0 deletions
|
@ -937,6 +937,12 @@ operator << (std::basic_ostream<charT,traits>& out,
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// hash function
|
||||||
|
inline std::size_t hash_value(value const& val)
|
||||||
|
{
|
||||||
|
return hash_value(val);
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace value_adl_barrier
|
} // namespace value_adl_barrier
|
||||||
|
|
||||||
using value_adl_barrier::value;
|
using value_adl_barrier::value;
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
#include <mapnik/value_types.hpp>
|
#include <mapnik/value_types.hpp>
|
||||||
|
#include <mapnik/value.hpp>
|
||||||
#include <mapnik/util/conversions.hpp>
|
#include <mapnik/util/conversions.hpp>
|
||||||
#include <boost/detail/lightweight_test.hpp>
|
#include <boost/detail/lightweight_test.hpp>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
#include <boost/unordered_map.hpp>
|
||||||
|
|
||||||
#if defined(_MSC_VER) && _MSC_VER < 1900
|
#if defined(_MSC_VER) && _MSC_VER < 1900
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
|
@ -282,6 +284,14 @@ int main(int argc, char** argv)
|
||||||
BOOST_TEST_EQ( val, false );
|
BOOST_TEST_EQ( val, false );
|
||||||
BOOST_TEST( string2bool("true",val) );
|
BOOST_TEST( string2bool("true",val) );
|
||||||
BOOST_TEST_EQ( val, true );
|
BOOST_TEST_EQ( val, true );
|
||||||
|
|
||||||
|
// mapnik::value hashability
|
||||||
|
using values_container = boost::unordered_map<mapnik::value, unsigned>;
|
||||||
|
values_container vc;
|
||||||
|
mapnik::value val2(1);
|
||||||
|
vc[val2] = 1;
|
||||||
|
BOOST_TEST_EQ( vc[1], 1 );
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (std::exception const & ex)
|
catch (std::exception const & ex)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue