Can't create a map with first key floating-point 0
Here's a failing test:
TEST(NodeTest, CreateMapWithFloatingPoint0Key) {
Node node;
node[0.0] = 1.0;
EXPECT_TRUE(node.IsMap());
}
It doesn't work because the specialization of get_idx in node/detail/impl.h is enabled on std::is_signed condition, which returns true for floating-point types, while the Key template parameter of get_idx is expected to be integral.
The result is that get_idx succeeds and the node is converted to a sequence instead of a map, with the value added at index 0.
This can be fixed by adding && std::is_integral<Key>::value to the std::enable_if<std::is_signed<Key>::value> specialization of get_idx in node/detail/impl.h.
I suppose the same same has to be done for the specialization of remove_idx in the same file.
Sorry, I incorrectly posted this from my company's account.
Agreed, this is a bug, thank you! Feel free to submit a PR with that fix.
Sorry, I haven't used GitHub for development yet, it will take time until I figure out how to submit PRs...