Change node_map type from map<ptr,ptr> to vector<pair<ptr,ptr>> (#386)

* Change node_map type from map<ptr,ptr> to vector<pair<ptr,ptr>>

Map nodes are now iterated over in document order.

* Change insert_map_pair to always append

Always append in insert_map_pair even if the key is already present.
This breaks the behavior of force_insert which now always inserts KVs
even if the key is already present. The first insert for duplicated keys
now takes precedence for lookups.
This commit is contained in:
c0nk
2016-07-18 15:54:10 +02:00
committed by Jesse Beder
parent f74ae543b4
commit f0b15cd6a0
4 changed files with 7 additions and 6 deletions

View File

@@ -103,8 +103,8 @@ TEST(NodeTest, MapForceInsert) {
node.force_insert(k2, v2);
EXPECT_EQ("v1", node["k1"].as<std::string>());
EXPECT_EQ("v2", node["k2"].as<std::string>());
EXPECT_EQ(2, node.size());
EXPECT_EQ("v1", node["k2"].as<std::string>());
EXPECT_EQ(3, node.size());
}
TEST(NodeTest, UndefinedConstNodeWithFallback) {