Partager via


deque Class Members

Reference

Constructors

deque

Constructs a deque. Several constructors are provided to set up the contents of the new deque in different ways: empty; loaded with a specified number of empty elements; contents moved or copied from another deque; contents copied or moved by using an iterator; and one element copied into the deque _Count times. Some of the constructors enable using a custom allocator to create elements.

Typedefs

allocator_type

A type that represents the allocator class for the deque object.

const_iterator

A type that provides a random-access iterator that can access and read elements in the deque as const

const_pointer

A type that provides a pointer to an element in a deque as a const.

const_reference

A type that provides a reference to an element in a deque for reading and other operations as a const.

const_reverse_iterator

A type that provides a random-access iterator that can access and read elements in the deque as const. The deque is viewed in reverse. For more information, see reverse_iterator Class

difference_type

A type that provides the difference between two random-access iterators that refer to elements in the same deque.

iterator

A type that provides a random-access iterator that can read or modify any element in a deque.

pointer

A type that provides a pointer to an element in a deque.

reference

A type that provides a reference to an element stored in a deque.

reverse_iterator

A type that provides a random-access iterator that can read or modify an element in a deque. The deque is viewed in reverse order.

size_type

A type that counts the number of elements in a deque.

value_type

A type that represents the data type stored in a deque.

Member Functions

assign

Erases elements from a deque and copies a new sequence of elements to the target deque.

at

Returns a reference to the element at a specified location in the deque.

back

Returns a reference to the last element of the deque.

begin

Returns a random-access iterator addressing the first element in the deque.

deque::cbegin

Returns a const iterator to the first element in the deque.

deque::cend

Returns a random-access const iterator that points just beyond the end of the deque.

clear

Erases all the elements of a deque.

deque::crbegin

Returns a random-access const iterator to the first element in a deque viewed in reverse order.

deque::crend

Returns a random-access const iterator to the first element in a deque viewed in reverse order.

deque::emplace

Inserts an element constructed in place into the deque at a specified position.

deque::emplace_back

Adds an element constructed in place to the end of the deque.

deque::emplace_front

Adds an element constructed in place to the start of the deque.

empty

Returns true if the deque contains zero elements, and false if it contains one or more elements.

end

Returns a random-access iterator that points just beyond the end of the deque.

erase

Removes an element or a range of elements in a deque from specified positions.

front

Returns a reference to the first element in a deque.

get_allocator

Returns a copy of the allocator object that is used to construct the deque.

insert

Inserts an element, several elements, or a range of elements into the deque at a specified position.

max_size

Returns the maximum possible length of the deque.

pop_back

Erases the element at the end of the deque.

pop_front

Erases the element at the start of the deque.

push_back

Adds an element to the end of the deque.

push_front

Adds an element to the start of the deque.

rbegin

Returns a random-access iterator to the first element in a reversed deque.

rend

Returns a random-access iterator that points just beyond the last element in a reversed deque.

resize

Specifies a new size for a deque.

deque::shrink_to_fit

Discards excess capacity.

size

Returns the number of elements in the deque.

swap

Exchanges the elements of two deques.

Operators

operator[]

Returns a reference to the deque element at a specified position.

deque::operator=

Replaces the elements of the deque with a copy of another deque.

See Also

Reference

deque Class

reverse_iterator Class

Thread Safety in the Standard C++ Library

Standard Template Library