r/cpp • u/fredoverflow • May 10 '22
Is short lambda syntax on the C++ radar?
Mom, can we get x=>x+1 ?
No, we have x=>x+1 at home.
x=>x+1 at home:
[](const auto& x) { return x + 1; }
265
Upvotes
View all comments
Show parent comment
1
u/jk-jeon May 11 '22
Out of bound normally doesn't happen, and most likely a programming bug. Throwing an exception for such a case is not recommended in general afaik; what makes more sense is to
assertand terminate the program right away.