expand std::hash<mapnik::value> and operator== test for all types in mapnik::value
This commit is contained in:
parent
fa2d63c601
commit
641cd6555e
1 changed files with 8 additions and 5 deletions
|
@ -284,16 +284,19 @@ SECTION("to string") {
|
||||||
REQUIRE( string2bool("true",val) );
|
REQUIRE( string2bool("true",val) );
|
||||||
REQUIRE( val == true );
|
REQUIRE( val == true );
|
||||||
|
|
||||||
// mapnik::value hashability
|
// mapnik::value hash() and operator== works for all T in value<Types...>
|
||||||
|
mapnik::transcoder tr("utf8");
|
||||||
using values_container = std::unordered_map<mapnik::value, unsigned>;
|
using values_container = std::unordered_map<mapnik::value, unsigned>;
|
||||||
values_container vc;
|
values_container vc;
|
||||||
mapnik::value val2(1);
|
mapnik::value keys[5] = {true, 1, 3.14159f, tr.transcode("Мапник"), mapnik::value_null()} ;
|
||||||
vc[val2] = 1;
|
for (auto const& k : keys)
|
||||||
REQUIRE( vc[1] == static_cast<int>(1) );
|
{
|
||||||
|
vc.insert({k, 123456789});
|
||||||
|
REQUIRE( vc[k] == 123456789 );
|
||||||
|
}
|
||||||
|
|
||||||
// mapnik::value << to ostream
|
// mapnik::value << to ostream
|
||||||
std::stringstream s;
|
std::stringstream s;
|
||||||
mapnik::transcoder tr("utf-8");
|
|
||||||
mapnik::value_unicode_string ustr = tr.transcode("hello world!");
|
mapnik::value_unicode_string ustr = tr.transcode("hello world!");
|
||||||
mapnik::value streamable(ustr);
|
mapnik::value streamable(ustr);
|
||||||
s << streamable;
|
s << streamable;
|
||||||
|
|
Loading…
Reference in a new issue