Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacques Lucke <jacques@blender.org>2021-04-17 19:39:35 +0300
committerJacques Lucke <jacques@blender.org>2021-04-17 19:39:35 +0300
commitd0d85742fc16aedb8e2145ca76fa77bd47ec2e54 (patch)
treed2b5ea7ff05c085db59d99d9b191578b4ffae3da /source/blender/blenlib/tests/BLI_map_test.cc
parent5cf6f570c65daa3325055e54bb07fa864f269960 (diff)
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.
Diffstat (limited to 'source/blender/blenlib/tests/BLI_map_test.cc')
-rw-r--r--source/blender/blenlib/tests/BLI_map_test.cc9
1 files changed, 9 insertions, 0 deletions
diff --git a/source/blender/blenlib/tests/BLI_map_test.cc b/source/blender/blenlib/tests/BLI_map_test.cc
index f1ae8fb3921..bb15f7f0d8d 100644
--- a/source/blender/blenlib/tests/BLI_map_test.cc
+++ b/source/blender/blenlib/tests/BLI_map_test.cc
@@ -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.
*/