Lambda Expressions Flashcards

1
Q

What is a lambda expression?

A

Anonymous function you can pass to another function’s parameter

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Where are lambda functions defined?

A

Locally inside a function

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

for_each algorithm does what?

A

Performs task for each element in container

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is the introducer ([]) and what is it knows as?

A

Specifies which local variable from function to use, known as capturing

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

auto

A

Infers parameter type, unlike generic lambdas

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What do lambda expressions do?

A

Provide simplified syntax for defining function objects directly where they are used

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

& in lambda introducer specifies…..?

A

Local variable by reference

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What statement allows compiler to infer lambdas return type?

A

return expression;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly