Lecture 7 - Lambas & Auto Flashcards

1
Q

What does the auto keyword do?

A

It is local type inference, so we don’t have to explicitly write what type the variable is.

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

When is auto useful?

A

When we have long type names.

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

What is a lambda expression?

A

having anonymous functions (AKA function literals)

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

What is a lambda expression made of of in C/C++?

A

captures, parameters and body

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

What is the capture?

A

The variables we pass in at creation, could be global variables.

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

What are the parameters.

A

The things passed in to function when called.

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

What is the body?

A

The actual code of the function.

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

How are the parameters passed to a lambda function?

A

By value

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

How are functions passed into pthreads?

A

as void * type, this means we need to cast a type before using

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