BLI: support multiple arguments for value in *_as methods of Map
This allows us to build more complex values in-place in the map. Before those values had to be build separately and then moved into the map. Existing calls to the Map API remain unchanged.
This commit is contained in:
@@ -604,6 +604,15 @@ TEST(map, GenericAlgorithms)
|
||||
EXPECT_EQ(std::count(map.keys().begin(), map.keys().end(), 7), 1);
|
||||
}
|
||||
|
||||
TEST(map, AddAsVariadic)
|
||||
{
|
||||
Map<int, StringRef> map;
|
||||
map.add_as(3, "hello", 2);
|
||||
map.add_as(2, "test", 1);
|
||||
EXPECT_EQ(map.lookup(3), "he");
|
||||
EXPECT_EQ(map.lookup(2), "t");
|
||||
}
|
||||
|
||||
/**
|
||||
* Set this to 1 to activate the benchmark. It is disabled by default, because it prints a lot.
|
||||
*/
|
||||
|
Reference in New Issue
Block a user