Re:Rust: Systems Programming for Everyone
by soulbadguy on Saturday August 20, 2016 @12:43PM
(#12327276)
What's the bug ? (hopefully it's not just a missing break statement.
[ Parent
| on HN ]
Re:Rust: Systems Programming for Everyone
by RcouF1uZ4gsC on Saturday August 20, 2016 @01:17PM
(#12327441)
The problem is that the pair in the for loop should have a const T as the first parameter. Because it does not have that, you are actually getting a temporary back and storing a pointer to a temporary in selected.
The fix to avoid this is to use auto. If instead of pair, you used auto&& p: map, this would not be an issue