fennec
Loading...
Searching...
No Matches
fennec::deque< TypeT, AllocT >

Data structure defining a double-ended queue. More...

#include <deque.h>

Detailed Description

template<typename TypeT, typename AllocT = allocator<TypeT>>
struct fennec::deque< TypeT, AllocT >

This behaves the similar to fennec::list, however it does not allow arbitrary access, insertion, or deletion. It is one of the few data structures in this library that is stable, i.e. pointers to elements do not change.

Property Value
stable
dynamic
homogenous
distinct
ordered
space \(O(N)\)
linear
access \(O(1)\)
find \(O(N)\)
insertion \(O(1)\)
deletion \(O(1)\)
Template Parameters
TypeTvalue type

Public Types

using value_t = TypeT
 Alias for the value type.
 

Public Member Functions

Constructors & Destructor
 deque ()
 Default Constructor, initializes an empty deque.
 
 deque (const alloc_t &alloc)
 Alloc Constructor, initializes an empty deque with the specified allocator.
 
 deque (const deque &deque)
 Copy Constructor.
 
 deque (deque &&deque) noexcept
 Deque Move Constructor.
 
 ~deque ()
 Destructor, calls deque::clear.
 
Properties
constexpr bool empty () const
 
constexpr size_t size () const
 
Access
value_tfront ()
 
const value_tfront () const
 
value_tback ()
 
const value_tback () const
 
Modifiers
void push_front (value_t &&elem)
 Push Front Move, moves a value to the front of the deque.
 
void push_front (const value_t &elem)
 Push Front Copy, copies a value to the front of the deque.
 
template<typename... ArgsT>
void emplace_front (ArgsT &&...args)
 Emplace Front, constructs a new value at the front of the deque.
 
void push_back (value_t &&elem)
 Push Back Move, moves a value to the back of the deque.
 
void push_back (const value_t &elem)
 Push Back Copy, copies a value to the back of the deque.
 
template<typename... ArgsT>
void emplace_back (ArgsT &&...args)
 Emplace Back, constructs a new value at the back of the deque.
 
void clear ()
 Clears the contents of the deque.
 
void pop_front ()
 Erase the First Element.
 
void pop_back ()
 Erase the Last Element.
 

Constructor & Destructor Documentation

◆ deque() [1/3]

template<typename TypeT , typename AllocT = allocator<TypeT>>
fennec::deque< TypeT, AllocT >::deque ( const alloc_t &  alloc)
inline
Parameters
allocthe allocator to copy

◆ deque() [2/3]

template<typename TypeT , typename AllocT = allocator<TypeT>>
fennec::deque< TypeT, AllocT >::deque ( const deque< TypeT, AllocT > &  deque)
inline
Parameters
dequethe deque to copy

◆ deque() [3/3]

template<typename TypeT , typename AllocT = allocator<TypeT>>
fennec::deque< TypeT, AllocT >::deque ( deque< TypeT, AllocT > &&  deque)
inlinenoexcept
Parameters
dequethe deque to move

Member Function Documentation

◆ empty()

template<typename TypeT , typename AllocT = allocator<TypeT>>
constexpr bool fennec::deque< TypeT, AllocT >::empty ( ) const
inlineconstexpr
Returns
true when the deque is empty, false otherwise

◆ size()

template<typename TypeT , typename AllocT = allocator<TypeT>>
constexpr size_t fennec::deque< TypeT, AllocT >::size ( ) const
inlineconstexpr
Returns
the number of elements in size()

◆ front() [1/2]

template<typename TypeT , typename AllocT = allocator<TypeT>>
value_t & fennec::deque< TypeT, AllocT >::front ( )
inline
Returns
a reference to the first element in the deque

◆ front() [2/2]

template<typename TypeT , typename AllocT = allocator<TypeT>>
const value_t & fennec::deque< TypeT, AllocT >::front ( ) const
inline
Returns
a const-qualified reference to the first element in the deque

◆ back() [1/2]

template<typename TypeT , typename AllocT = allocator<TypeT>>
value_t & fennec::deque< TypeT, AllocT >::back ( )
inline
Returns
a reference to the last element in the deque

◆ back() [2/2]

template<typename TypeT , typename AllocT = allocator<TypeT>>
const value_t & fennec::deque< TypeT, AllocT >::back ( ) const
inline
Returns
a const-qualified reference to the last element in the deque

◆ push_front() [1/2]

template<typename TypeT , typename AllocT = allocator<TypeT>>
void fennec::deque< TypeT, AllocT >::push_front ( value_t &&  elem)
inline
Parameters
elemthe value to move

◆ push_front() [2/2]

template<typename TypeT , typename AllocT = allocator<TypeT>>
void fennec::deque< TypeT, AllocT >::push_front ( const value_t elem)
inline
Parameters
elemthe value to copy

◆ emplace_front()

template<typename TypeT , typename AllocT = allocator<TypeT>>
template<typename... ArgsT>
void fennec::deque< TypeT, AllocT >::emplace_front ( ArgsT &&...  args)
inline
Template Parameters
ArgsTArgument types
Parameters
argsArguments used to construct the value

◆ push_back() [1/2]

template<typename TypeT , typename AllocT = allocator<TypeT>>
void fennec::deque< TypeT, AllocT >::push_back ( value_t &&  elem)
inline
Parameters
elemthe value to move

◆ push_back() [2/2]

template<typename TypeT , typename AllocT = allocator<TypeT>>
void fennec::deque< TypeT, AllocT >::push_back ( const value_t elem)
inline
Parameters
elemthe value to copy

◆ emplace_back()

template<typename TypeT , typename AllocT = allocator<TypeT>>
template<typename... ArgsT>
void fennec::deque< TypeT, AllocT >::emplace_back ( ArgsT &&...  args)
inline
Template Parameters
ArgsTArgument types
Parameters
argsArguments used to construct the value

The documentation for this struct was generated from the following file: