3 ms·
The stringview example is surprising and certainly something I could have fallen for. I feel like the lambda example is pretty contrived. If I was returning a
by MiroF 8y ago
The stringview example is surprising and certainly something I could have fallen for.
I feel like the lambda example is pretty contrived. If I was returning a lambda that was capturing values by reference, I would already be pretty wary of UB.
- umanwizard 8y agoI guess it comes down to the individual reader. I had to look at the lambda example several times to realize what the problem was with it. I guess my eyes just skim over the capture section unless I have some good reason to look at it. The string_view example, on the other hand, was immediately obviously wrong to me.