Вы находитесь на странице: 1из 3

This website uses cookies. By continuing, you give permission to deploy cookies, as detailed in our privacy policy.

ok

Search: Go
Not logged in

Reference <deque> deque register log in

C++
Information GUI Virtualization SDK
Tutorials
Instantly take your legacy windows applications to the LEARN MORE
Reference
web using our Web enabling SDK
Articles
Forum
class template
Reference
deque
<deque>
C library: std::
Containers: template < class T, class Alloc = allocator<T> > class deque;
<array>
Double ended queue
<deque>
deque (usually pronounced like "deck") is an irregular acronym of double-ended queue. Double-ended queues are
<forward_list>
sequence containers with dynamic sizes that can be expanded or contracted on both ends (either its front or its back).
<list>
<map>
Specific libraries may implement deques in different ways, generally as some form of dynamic array. But in any case,
<queue>
they allow for the individual elements to be accessed directly through random access iterators, with storage handled
<set> automatically by expanding and contracting the container as needed.
<stack>
<unordered_map> Therefore, they provide a functionality similar to vectors, but with efficient insertion and deletion of elements also at
<unordered_set> the beginning of the sequence, and not only at its end. But, unlike vectors, deques are not guaranteed to store all its
<vector> elements in contiguous storage locations: accessing elements in a deque by offsetting a pointer to another element
Input/Output: causes undefined behavior.
Multi-threading:
Other: Both vectors and deques provide a very similar interface and can be used for similar purposes, but internally both work
in quite different ways: While vectors use a single array that needs to be occasionally reallocated for growth, the
<deque> elements of a deque can be scattered in different chunks of storage, with the container keeping the necessary
deque information internally to provide direct access to any of its elements in constant time and with a uniform sequential
interface (through iterators). Therefore, deques are a little more complex internally than vectors, but this allows them
deque to grow more efficiently under certain circumstances, especially with very long sequences, where reallocations become
deque::deque more expensive.
deque::~deque
member functions: For operations that involve frequent insertion or removals of elements at positions other than the beginning or the end,
deque::assign deques perform worse and have less consistent iterators and references than lists and forward lists.
deque::at
deque::back
deque::begin
Container properties
deque::cbegin
Sequence
deque::cend Elements in sequence containers are ordered in a strict linear sequence. Individual elements are accessed by
deque::clear their position in this sequence.
deque::crbegin
Dynamic array
deque::crend
Generally implemented as a dynamic array, it allows direct access to any element in the sequence and provides
deque::emplace
relatively fast addition/removal of elements at the beginning or the end of the sequence.
deque::emplace_back
Allocator-aware
deque::emplace_front
The container uses an allocator object to dynamically handle its storage needs.
deque::empty
deque::end
deque::erase
deque::front Template parameters
deque::get_allocator
deque::insert T
deque::max_size Type of the elements.
deque::operator= Aliased as member type deque::value_type.
deque::operator[] Alloc
deque::pop_back Type of the allocator object used to define the storage allocation model. By default, the allocator class template
deque::pop_front is used, which defines the simplest memory allocation model and is value-independent.
deque::push_back Aliased as member type deque::allocator_type.
deque::push_front
deque::rbegin
deque::rend
deque::resize Member types
deque::shrink_to_fit
C++98 C++11
deque::size
deque::swap member type definition notes
non-member overloads: value_type The first template parameter (T)
relational operators (deque) defaults to:
swap (deque) allocator_type The second template parameter (Alloc)
allocator<value_type>
for the default allocator:
Fcase reference allocator_type::reference
value_type&
Simplifies fraud management and significantly
improves operational efficiency. FCASE
for the default allocator:
const_reference allocator_type::const_reference
const value_type&
for the default allocator:
pointer allocator_type::pointer
value_type*
for the default allocator:
const_pointer allocator_type::const_pointer
const value_type*
iterator a random access iterator to value_type convertible to
const_iterator
const_iterator a random access iterator to const value_type
reverse_iterator reverse_iterator<iterator>
const_reverse_iterator reverse_iterator<const_iterator>
a signed integral type, identical to:
difference_type usually the same as ptrdiff_t
iterator_traits<iterator>::difference_type
an unsigned integral type that can represent any non-
size_type usually the same as size_t
negative value of difference_type

Member functions
(constructor) Construct deque container (public member function )
(destructor) Deque destructor (public member function )
operator= Assign content (public member function )

Iterators:
begin Return iterator to beginning (public member function )
end Return iterator to end (public member function )
rbegin Return reverse iterator to reverse beginning (public member function )
rend Return reverse iterator to reverse end (public member function )
cbegin Return const_iterator to beginning (public member function )
cend Return const_iterator to end (public member function )
crbegin Return const_reverse_iterator to reverse beginning (public member function )
crend Return const_reverse_iterator to reverse end (public member function )

Capacity:
size Return size (public member function )
max_size Return maximum size (public member function )
resize Change size (public member function )
empty Test whether container is empty (public member function )
shrink_to_fit Shrink to fit (public member function )

Element access:
operator[] Access element (public member function )
at Access element (public member function )
front Access first element (public member function )
back Access last element (public member function )

Modifiers:
assign Assign container content (public member function )
push_back Add element at the end (public member function )
push_front Insert element at beginning (public member function )
pop_back Delete last element (public member function )
pop_front Delete first element (public member function )
insert Insert elements (public member function )
erase Erase elements (public member function )
swap Swap content (public member function )
clear Clear content (public member function )
emplace Construct and insert element (public member function )
emplace_front Construct and insert element at beginning (public member function )
emplace_back Construct and insert element at the end (public member function )

Allocator:
get_allocator Get allocator (public member function )

Non-member functions overloads


relational operators Relational operators for deque (function )
swap Exchanges the contents of two deque containers (function template )
Home page | Privacy policy
© cplusplus.com, 2000-2019 - All rights reserved - v3.1
Spotted an error? contact us

Вам также может понравиться