Skip to content

Commit 009dd3c

Browse files
committed
Add by value write
1 parent 0a507ac commit 009dd3c

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

‎tests/unit/foreach_map.cpp‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,12 @@ int main() {
1414
sum += i.first;
1515
}
1616
assert(sum == 7475);
17+
for (auto i : m) {
18+
i.second = -1;
19+
assert(i.second == -1);
20+
}
21+
for (const auto &i : m) {
22+
assert(i.second != -1);
23+
}
1724
return 0;
1825
}

0 commit comments

Comments
 (0)