ORIGINAL
Loading...
Searching...
No Matches
original::deque< TYPE, SERIAL, ALLOC > Class Template Referencefinal

Double-ended queue container adapter. More...

#include <deque.h>

Inheritance diagram for original::deque< TYPE, SERIAL, ALLOC >:
Inheritance graph
Collaboration diagram for original::deque< TYPE, SERIAL, ALLOC >:
Collaboration graph

Public Member Functions

 deque (const SERIAL< TYPE, ALLOC< TYPE > > &serial=SERIAL< TYPE, ALLOC< TYPE > >{})
 Constructs deque with specified underlying container and allocator.
 
 deque (const std::initializer_list< TYPE > &lst)
 Constructs deque from initializer list with allocator.
 
 deque (const deque &other)
 Copy constructs a deque with allocator propagation.
 
dequeoperator= (const deque &other)
 Copy assignment operator.
 
 deque (deque &&other) noexcept
 Move constructs a deque with allocator propagation.
 
dequeoperator= (deque &&other) noexcept
 Move assignment operator.
 
void pushBegin (const TYPE &e)
 Inserts element at the front.
 
void pushEnd (const TYPE &e)
 Inserts element at the back.
 
TYPE popBegin ()
 Removes and returns front element.
 
TYPE popEnd ()
 Removes and returns back element.
 
TYPE head () const
 Accesses front element.
 
TYPE tail () const
 Accesses back element.
 
std::string className () const override
 Gets class name identifier.
 
- Public Member Functions inherited from original::containerAdapter< TYPE, chain, allocator >
u_integer size () const override
 Returns the number of elements in the adapter.
 
void clear ()
 Removes all elements from the adapter.
 
bool contains (const TYPE &e) const override
 Checks for element existence in the adapter.
 
integer compareTo (const containerAdapter &other) const override
 Compares two container adapters lexicographically.
 
std::string toString (bool enter) const override
 Generates formatted string representation.
 
 ~containerAdapter () override=default
 Virtual destructor for proper polymorphic cleanup.
 
- Public Member Functions inherited from original::printable
 operator std::string () const
 Explicit conversion to std::string.
 
 operator const char * () const
 Explicit conversion to C-style string.
 
const char * toCString (bool enter) const
 Direct C-string access with formatting control.
 
template<typename TYPE>
auto formatString (const TYPE &t) -> std::string
 
template<typename TYPE>
auto formatCString (const TYPE &t) -> const char *
 
template<typename TYPE>
auto formatEnum (const TYPE &t) -> std::string
 
template<typename TYPE>
auto formatString (TYPE *const &ptr) -> std::string
 
- Public Member Functions inherited from original::container< TYPE, allocator< TYPE > >
bool empty () const
 Checks if the container is empty.
 
virtual ~container ()=default
 Destructor for the container class.
 
- Public Member Functions inherited from original::comparable< containerAdapter< TYPE, chain, allocator > >
virtual integer compareTo (const containerAdapter< TYPE, chain, allocator > &other) const=0
 Compares the current object with another of the same type.
 
bool operator== (const containerAdapter< TYPE, chain, allocator > &other) const
 Checks if the current object is equal to another.
 
bool operator!= (const containerAdapter< TYPE, chain, allocator > &other) const
 Checks if the current object is not equal to another.
 
bool operator< (const containerAdapter< TYPE, chain, allocator > &other) const
 Checks if the current object is less than another.
 
bool operator> (const containerAdapter< TYPE, chain, allocator > &other) const
 Checks if the current object is greater than another.
 
bool operator<= (const containerAdapter< TYPE, chain, allocator > &other) const
 Checks if the current object is less than or equal to another.
 
bool operator>= (const containerAdapter< TYPE, chain, allocator > &other) const
 Checks if the current object is greater than or equal to another.
 
virtual ~comparable ()=default
 Virtual destructor for proper cleanup of derived objects.
 

Additional Inherited Members

- Static Public Member Functions inherited from original::printable
template<typename TYPE>
static std::string formatString (const TYPE &t)
 Universal value-to-string conversion.
 
template<typename TYPE>
static std::string formatString (TYPE *const &ptr)
 Pointer-specific formatting.
 
template<typename TYPE>
static const char * formatCString (const TYPE &t)
 C-string cache for temporary usage.
 
template<typename TYPE>
static std::string formatEnum (const TYPE &t)
 Enum formatting utility.
 
template<>
auto formatString (const char &t) -> std::string
 
template<>
auto formatString (const bool &t) -> std::string
 
template<>
auto formatString (const char *const &ptr) -> std::string
 
- Protected Member Functions inherited from original::containerAdapter< TYPE, chain, allocator >
 containerAdapter (const chain< TYPE, allocator< TYPE > > &serial)
 Constructs a container adapter with specified underlying container.
 
- Protected Member Functions inherited from original::container< TYPE, allocator< TYPE > >
 container (allocator< TYPE > alloc=allocator< TYPE >{})
 Constructs a container with specified allocator.
 
TYPE * allocate (u_integer size)
 Allocates raw memory for elements.
 
void deallocate (TYPE *ptr, u_integer size)
 Deallocates memory previously allocated by allocate()
 
void construct (O_TYPE *o_ptr, Args &&... args)
 Constructs an element in-place.
 
void destroy (O_TYPE *o_ptr)
 Destroys an element.
 
- Protected Attributes inherited from original::containerAdapter< TYPE, chain, allocator >
chain< TYPE, allocator< TYPE > > serial_
 The underlying container instance.
 
- Protected Attributes inherited from original::container< TYPE, allocator< TYPE > >
allocator< TYPE > allocator
 The allocator instance used for memory management.
 

Detailed Description

template<typename TYPE, template< typename, typename > typename SERIAL = chain, template< typename > typename ALLOC = allocator>
class original::deque< TYPE, SERIAL, ALLOC >

Double-ended queue container adapter.

Template Parameters
TYPEType of elements stored in the deque
SERIALUnderlying container type (default: chain)
ALLOCAllocator template for memory management (default: allocator)

Implements deque operations using the specified underlying container. Supports efficient insertion and removal at both front and back ends. Inherits template constraints from original::containerAdapter.

The allocator is propagated to both the deque adapter and the underlying serial container for consistent memory management.

Constructor & Destructor Documentation

◆ deque() [1/4]

template<typename TYPE, template< typename, typename > typename SERIAL, template< typename > typename ALLOC>
original::deque< TYPE, SERIAL, ALLOC >::deque ( const SERIAL< TYPE, ALLOC< TYPE > > & serial = SERIAL<TYPE, ALLOC<TYPE>>{})
explicit

Constructs deque with specified underlying container and allocator.

Parameters
serialContainer instance to initialize deque (default: empty)

The allocator from the provided container will be used for all memory operations. If no container is provided, a default-constructed container with default allocator will be used.

◆ deque() [2/4]

template<typename TYPE, template< typename, typename > typename SERIAL, template< typename > typename ALLOC>
original::deque< TYPE, SERIAL, ALLOC >::deque ( const std::initializer_list< TYPE > & lst)

Constructs deque from initializer list with allocator.

Parameters
lstList of elements for initial content

Uses the default allocator to construct the underlying container and populate it with elements from the initializer list.

◆ deque() [3/4]

template<typename TYPE, template< typename, typename > typename SERIAL, template< typename > typename ALLOC>
original::deque< TYPE, SERIAL, ALLOC >::deque ( const deque< TYPE, SERIAL, ALLOC > & other)

Copy constructs a deque with allocator propagation.

Parameters
otherDeque instance to copy from
Note
The allocator is copied if ALLOC::propagate_on_container_copy_assignment is true

◆ deque() [4/4]

template<typename TYPE, template< typename, typename > typename SERIAL, template< typename > typename ALLOC>
original::deque< TYPE, SERIAL, ALLOC >::deque ( deque< TYPE, SERIAL, ALLOC > && other)
noexcept

Move constructs a deque with allocator propagation.

Parameters
otherDeque instance to move from
Note
The allocator is moved if ALLOC::propagate_on_container_move_assignment is true
noexcept guarantees exception safety during move

Member Function Documentation

◆ className()

template<typename TYPE, template< typename, typename > typename SERIAL, template< typename > typename ALLOC>
auto original::deque< TYPE, SERIAL, ALLOC >::className ( ) const
nodiscardoverridevirtual

Gets class name identifier.

Returns
"deque" string identifier

Reimplemented from original::containerAdapter< TYPE, chain, allocator >.

◆ head()

template<typename TYPE, template< typename, typename > typename SERIAL, template< typename > typename ALLOC>
auto original::deque< TYPE, SERIAL, ALLOC >::head ( ) const

Accesses front element.

Returns
Const reference to front element
Precondition
Deque must not be empty

◆ operator=() [1/2]

template<typename TYPE, template< typename, typename > typename SERIAL, template< typename > typename ALLOC>
auto original::deque< TYPE, SERIAL, ALLOC >::operator= ( const deque< TYPE, SERIAL, ALLOC > & other)

Copy assignment operator.

Parameters
otherDeque instance to copy from
Returns
Reference to this deque

◆ operator=() [2/2]

template<typename TYPE, template< typename, typename > typename SERIAL, template< typename > typename ALLOC>
auto original::deque< TYPE, SERIAL, ALLOC >::operator= ( deque< TYPE, SERIAL, ALLOC > && other)
noexcept

Move assignment operator.

Parameters
otherDeque instance to move from
Returns
Reference to this deque
Note
noexcept guarantees exception safety during move

◆ popBegin()

template<typename TYPE, template< typename, typename > typename SERIAL, template< typename > typename ALLOC>
auto original::deque< TYPE, SERIAL, ALLOC >::popBegin ( )

Removes and returns front element.

Returns
The removed front element
Precondition
Deque must not be empty
Note
Uses the deque's allocator to destroy the removed element

◆ popEnd()

template<typename TYPE, template< typename, typename > typename SERIAL, template< typename > typename ALLOC>
auto original::deque< TYPE, SERIAL, ALLOC >::popEnd ( )

Removes and returns back element.

Returns
The removed back element
Precondition
Deque must not be empty
Note
Uses the deque's allocator to destroy the removed element

◆ pushBegin()

template<typename TYPE, template< typename, typename > typename SERIAL, template< typename > typename ALLOC>
auto original::deque< TYPE, SERIAL, ALLOC >::pushBegin ( const TYPE & e)

Inserts element at the front.

Parameters
eElement to insert

Uses the deque's allocator to construct the new element at the front

◆ pushEnd()

template<typename TYPE, template< typename, typename > typename SERIAL, template< typename > typename ALLOC>
auto original::deque< TYPE, SERIAL, ALLOC >::pushEnd ( const TYPE & e)

Inserts element at the back.

Parameters
eElement to insert

Uses the deque's allocator to construct the new element at the back

◆ tail()

template<typename TYPE, template< typename, typename > typename SERIAL, template< typename > typename ALLOC>
auto original::deque< TYPE, SERIAL, ALLOC >::tail ( ) const

Accesses back element.

Returns
Const reference to back element
Precondition
Deque must not be empty

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