STL and CTAD Flashcards

1
Q

What does STL stand for?

A

Standard Template Library

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

What does STL do?

A

Allows for generic typing.

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

What does CTAD do?

A

The compiler attempts to determine the most appropriate class template for the given data

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

What does CTAD stand for?

A

Class Template Argument Deduction

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

What is the keyword to enable generics?

A

Template

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

What is the syntax of setting a generic with template?

A

template < typename template_name>
return functionName(T varname)

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

What is one major difference between C++ and Java generics?

A

C++ generics can be primitives

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

What is the scope of a template?

A

From the beginning of the function / class name, to the end of the curly brackets. Only one function.

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

How do you call the templated function “template < typename T>
genericsExample(T first) {…}” with double 1.0?

A

genericsExample<double> (1.0);

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

How do you declare multiple templates for one function/class?

A

template < typename T, typename U, …>

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

How do you default the typing of a template to a?

A

template < typename T = default_type>

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

What issue do templates run into when used in both .h and .cpp?

A

“Undefined reference to …”

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

What can’t templates be declared in .h and implemented in .cpp?

A

Because the TODO

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

How do you avoid template functions / classes being undefined?

A

Implement in the .h, or declare and implement solely in .cpp.

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