Lambda Expressions Flashcards
1
Q
What is a lambda expression?
A
Anonymous function you can pass to another function’s parameter
2
Q
Where are lambda functions defined?
A
Locally inside a function
3
Q
for_each algorithm does what?
A
Performs task for each element in container
4
Q
What is the introducer ([]) and what is it knows as?
A
Specifies which local variable from function to use, known as capturing
5
Q
auto
A
Infers parameter type, unlike generic lambdas
6
Q
What do lambda expressions do?
A
Provide simplified syntax for defining function objects directly where they are used
7
Q
& in lambda introducer specifies…..?
A
Local variable by reference
8
Q
What statement allows compiler to infer lambdas return type?
A
return expression;