0

I cannot understand the grammar of [a, b](int c) {…} This question may be silly, but matters for me, thanks for your patience.

Enlico
  • 12,203
  • 5
  • 28
  • 59
Al2O3
  • 2,695
  • 4
  • 22
  • 46
  • 1
    This is a C++ 11 Lambda expression. It is function-like blocks of executable statements that you can insert where normally a function call would appear. Lambdas are more compact, efficient, and secure than function objects. – James Dong Oct 10 '17 at 06:47
  • Note that this is not an exact duplicate of the other questions, although the answers to the other should also answer this one – Christophe Oct 10 '17 at 07:13
  • @Christophe - Also note that the layout at the top of the post, where duplicate is linked, *intentionally* reads "This question already has an answer here". Managing *exact* duplicates on SO is intractable. – StoryTeller - Unslander Monica Oct 10 '17 at 07:20
  • @StoryTeller the duplicate is meant to avoid similar questions, where an OP could easily recognize his/her question and find out by himself/herself that there is already an answer to it. In this specific case however, the OP doesn’t know lambdas, so he would never by himself find the question nor recognize that it answers his question. – Christophe Oct 10 '17 at 11:37
  • @Christophe - The duplicate system is meant to prevent repeated posting of the same answers. And foster improvement of good ones, instead. The OP didn't know the term, but he knows the syntax, so their answer *is* there. – StoryTeller - Unslander Monica Oct 10 '17 at 11:41

0 Answers0