3 ms·
What's the bug ? (hopefully it's not just a missing break statement.
by soulbadguy 10y ago
What's the bug ? (hopefully it's not just a missing break statement.
- RcouF1uZ4gsC 10y agoThe 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