mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-20 00:51:42 +00:00
[upstream_utils] StringMap: fix structured bindings with move-only types (#7127)
This commit is contained in:
@@ -525,6 +525,16 @@ TEST_F(StringMapTest, StructuredBindings) {
|
||||
}
|
||||
}
|
||||
|
||||
TEST_F(StringMapTest, StructuredBindingsMoveOnly) {
|
||||
StringMap<MoveOnly> A;
|
||||
A.insert(std::make_pair("a", MoveOnly(42)));
|
||||
|
||||
for (auto &&[Key, Value] : A) {
|
||||
EXPECT_EQ("a", Key);
|
||||
EXPECT_EQ(42, Value.i);
|
||||
}
|
||||
}
|
||||
|
||||
namespace {
|
||||
// Simple class that counts how many moves and copy happens when growing a map
|
||||
struct CountCtorCopyAndMove {
|
||||
|
||||
Reference in New Issue
Block a user