Span Flashcards

1
Q

Iterators

begin( )

A

returns an iterator to the beginning
Parameters
(none)

Return value
Iterator to the first element.

Complexity
Constant.

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

Iterators

end( )

A

returns an iterator to the end
Parameters
(none)

Return value
Iterator to the element following the last element.

Complexity
Constant.

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

Iterators

rbegin( )

A

returns a reverse iterator to the beginning
Parameters
(none)

Return value
Reverse iterator to the first element.

Complexity
Constant.

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

Iterators

rend( )

A

returns a reverse iterator to the end
Parameters
(none)

Return value
Reverse iterator to the element following the last element.

Complexity
Constant.

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

Element access

front( )

A

access the first element
Parameters
(none)

Return value
A reference to the first element.

Complexity
Constant

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

Element access

back( )

A

access the last element
Parameters
(none)

Return value
A reference to the back element.

Complexity
Constant

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

Element access

operator[]

A
accesses an element of the sequence
Parameters
idx	-	the index of the element to access
Return value
A reference to the idx-th element of the sequence, i.e., data()[idx]

Exceptions
Throws nothing.

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

Element access

data( )

A

returns a pointer to the beginning of the sequence of elements
Return value
A pointer to the beginning of the sequence.

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

Observers

size( )

A

returns the number of elements in the sequence
Return value
The number of elements in the span.

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

Observers

size_bytes( )

A

returns the size of the sequence
Return value
The size of the sequence in bytes, i.e., size() * sizeof(element_type). in bytes

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

Observers

empty( )

A

checks if the sequence is empty
Return value
true if the span is empty (i.e., size() == 0); false otherwise.

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

Subviews

first( )

A

obtains a subspan consisting of the first N elements of the sequence
Return value
A span r that is a view over the first Count elements of *this, such that r.data() == this->data() && r.size() == Count.

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

Subviews

last( )

A

obtains a subspan consisting of the last N elements of the sequence
Return value
A span r that is a view over the last Count elements of *this, such that r.data() == this->data() + (this->size() - Count) && r.size() == Count.

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

Subviews

subspan( )

A

obtains a subspan
Return value
The requested subspan r, such that r.data() == this->data() + Offset. If Count is std::dynamic_extent, r.size() == this->size() - Offset; otherwise r.size() == Count.

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