mutable
A Database System for Research and Fast Prototyping
Loading...
Searching...
No Matches
Data Structures | Public Types | Public Member Functions | Private Member Functions | Private Attributes | Friends
m::doubly_linked_list< T, Allocator > Struct Template Reference

Implements a doubly-linked list with an overhead of just a single pointer per element. More...

#include <ADT.hpp>

Collaboration diagram for m::doubly_linked_list< T, Allocator >:
[legend]

Data Structures

struct  node_type
 
struct  the_iterator
 

Public Types

using value_type = T
 
using size_type = std::size_t
 
using allocator_type = Allocator
 
using reference_type = T &
 
using const_reference_type = const T &
 
using iterator = the_iterator< false >
 
using const_iterator = the_iterator< true >
 

Public Member Functions

 doubly_linked_list ()
 
template<is_allocator A = allocator_type>
 doubly_linked_list (A &&allocator)
 
template<typename InputIt >
 doubly_linked_list (InputIt begin, InputIt end, allocator_type &&allocator=allocator_type())
 
 ~doubly_linked_list ()
 
 doubly_linked_list (const doubly_linked_list &other)
 
 doubly_linked_list (doubly_linked_list &&other)
 
doubly_linked_listoperator= (doubly_linked_list other)
 
allocator_typeget_allocator () const noexcept
 
reference_type front ()
 
const_reference_type front () const
 
reference_type back ()
 
const_reference_type back () const
 
iterator begin ()
 
iterator end ()
 
const_iterator begin () const
 
const_iterator end () const
 
const_iterator cbegin () const
 
const_iterator cend () const
 
iterator rbegin ()
 
iterator rend ()
 
const_iterator rbegin () const
 
const_iterator rend () const
 
const_iterator crbegin () const
 
const_iterator crend () const
 
bool empty () const
 
size_type size () const
 
size_type max_size () const
 
template<typename... Args>
iterator emplace (const_iterator pos, Args &&... args)
 
template<typename... Args>
reference_type emplace_back (Args &&... args)
 
template<typename... Args>
reference_type emplace_front (Args &&... args)
 
void push_back (const value_type &value)
 
void push_back (value_type &&value)
 
void push_front (const value_type &value)
 
void push_front (value_type &&value)
 
iterator insert (const_iterator pos, const value_type &value)
 
iterator insert (const_iterator pos, value_type &&value)
 
iterator insert (const_iterator pos, size_type count, const value_type &value)
 
template<typename InputIt , typename = decltype(*std::declval<InputIt&>(), std::declval<InputIt&>()++, void())>
iterator insert (const_iterator pos, InputIt first, InputIt last)
 
iterator insert (const_iterator pos, std::initializer_list< value_type > ilist)
 
iterator erase (iterator pos)
 
iterator erase (const_iterator pos)
 
value_type pop_back ()
 
value_type pop_front ()
 
void clear ()
 
void reverse ()
 
void dump (std::ostream &out) const
 
void dump () const
 

Private Member Functions

node_typeallocate_node ()
 
void deallocate_node (node_type *ptr)
 

Private Attributes

allocator_type allocator_
 

‍the memory allocator


 
node_typehead_ = nullptr
 

‍points to the first node


 
node_typetail_ = nullptr
 

‍points to the last node


 
size_type size_ = 0
 

‍the number of elements/nodes in the list


 

Friends

void swap (doubly_linked_list &first, doubly_linked_list &second)
 
M_LCOV_EXCL_START friend std::ostream & operator<< (std::ostream &out, const doubly_linked_list &L)
 
std::string to_string (const doubly_linked_list &L)
 

Detailed Description

template<typename T, is_allocator Allocator = malloc_allocator>
struct m::doubly_linked_list< T, Allocator >

Implements a doubly-linked list with an overhead of just a single pointer per element.

Definition at line 384 of file ADT.hpp.

Member Typedef Documentation

◆ allocator_type

template<typename T , is_allocator Allocator = malloc_allocator>
using m::doubly_linked_list< T, Allocator >::allocator_type = Allocator

Definition at line 388 of file ADT.hpp.

◆ const_iterator

template<typename T , is_allocator Allocator = malloc_allocator>
using m::doubly_linked_list< T, Allocator >::const_iterator = the_iterator<true>

Definition at line 463 of file ADT.hpp.

◆ const_reference_type

template<typename T , is_allocator Allocator = malloc_allocator>
using m::doubly_linked_list< T, Allocator >::const_reference_type = const T&

Definition at line 391 of file ADT.hpp.

◆ iterator

template<typename T , is_allocator Allocator = malloc_allocator>
using m::doubly_linked_list< T, Allocator >::iterator = the_iterator<false>

Definition at line 462 of file ADT.hpp.

◆ reference_type

template<typename T , is_allocator Allocator = malloc_allocator>
using m::doubly_linked_list< T, Allocator >::reference_type = T&

Definition at line 390 of file ADT.hpp.

◆ size_type

template<typename T , is_allocator Allocator = malloc_allocator>
using m::doubly_linked_list< T, Allocator >::size_type = std::size_t

Definition at line 387 of file ADT.hpp.

◆ value_type

template<typename T , is_allocator Allocator = malloc_allocator>
using m::doubly_linked_list< T, Allocator >::value_type = T

Definition at line 386 of file ADT.hpp.

Constructor & Destructor Documentation

◆ doubly_linked_list() [1/5]

template<typename T , is_allocator Allocator = malloc_allocator>
m::doubly_linked_list< T, Allocator >::doubly_linked_list ( )
inline

Definition at line 474 of file ADT.hpp.

◆ doubly_linked_list() [2/5]

template<typename T , is_allocator Allocator = malloc_allocator>
template<is_allocator A = allocator_type>
m::doubly_linked_list< T, Allocator >::doubly_linked_list ( A &&  allocator)
inlineexplicit

Definition at line 477 of file ADT.hpp.

◆ doubly_linked_list() [3/5]

template<typename T , is_allocator Allocator = malloc_allocator>
template<typename InputIt >
m::doubly_linked_list< T, Allocator >::doubly_linked_list ( InputIt  begin,
InputIt  end,
allocator_type &&  allocator = allocator_type() 
)
inline

◆ ~doubly_linked_list()

template<typename T , is_allocator Allocator = malloc_allocator>
m::doubly_linked_list< T, Allocator >::~doubly_linked_list ( )
inline

Definition at line 489 of file ADT.hpp.

References m::doubly_linked_list< T, Allocator >::clear().

◆ doubly_linked_list() [4/5]

template<typename T , is_allocator Allocator = malloc_allocator>
m::doubly_linked_list< T, Allocator >::doubly_linked_list ( const doubly_linked_list< T, Allocator > &  other)
inlineexplicit

◆ doubly_linked_list() [5/5]

template<typename T , is_allocator Allocator = malloc_allocator>
m::doubly_linked_list< T, Allocator >::doubly_linked_list ( doubly_linked_list< T, Allocator > &&  other)
inline

Definition at line 495 of file ADT.hpp.

References m::doubly_linked_list< T, Allocator >::swap.

Member Function Documentation

◆ allocate_node()

template<typename T , is_allocator Allocator = malloc_allocator>
node_type * m::doubly_linked_list< T, Allocator >::allocate_node ( )
inlineprivate

◆ back() [1/2]

template<typename T , is_allocator Allocator = malloc_allocator>
reference_type m::doubly_linked_list< T, Allocator >::back ( )
inline

◆ back() [2/2]

template<typename T , is_allocator Allocator = malloc_allocator>
const_reference_type m::doubly_linked_list< T, Allocator >::back ( ) const
inline

◆ begin() [1/2]

template<typename T , is_allocator Allocator = malloc_allocator>
iterator m::doubly_linked_list< T, Allocator >::begin ( )
inline

◆ begin() [2/2]

template<typename T , is_allocator Allocator = malloc_allocator>
const_iterator m::doubly_linked_list< T, Allocator >::begin ( ) const
inline

Definition at line 510 of file ADT.hpp.

References m::doubly_linked_list< T, Allocator >::head_.

◆ cbegin()

template<typename T , is_allocator Allocator = malloc_allocator>
const_iterator m::doubly_linked_list< T, Allocator >::cbegin ( ) const
inline

◆ cend()

template<typename T , is_allocator Allocator = malloc_allocator>
const_iterator m::doubly_linked_list< T, Allocator >::cend ( ) const
inline

◆ clear()

template<typename T , is_allocator Allocator = malloc_allocator>
void m::doubly_linked_list< T, Allocator >::clear ( )
inline

◆ crbegin()

template<typename T , is_allocator Allocator = malloc_allocator>
const_iterator m::doubly_linked_list< T, Allocator >::crbegin ( ) const
inline

Definition at line 519 of file ADT.hpp.

References m::doubly_linked_list< T, Allocator >::rbegin().

◆ crend()

template<typename T , is_allocator Allocator = malloc_allocator>
const_iterator m::doubly_linked_list< T, Allocator >::crend ( ) const
inline

Definition at line 520 of file ADT.hpp.

References m::doubly_linked_list< T, Allocator >::rend().

◆ deallocate_node()

template<typename T , is_allocator Allocator = malloc_allocator>
void m::doubly_linked_list< T, Allocator >::deallocate_node ( node_type ptr)
inlineprivate

◆ dump() [1/2]

template<typename T , is_allocator Allocator = malloc_allocator>
void m::doubly_linked_list< T, Allocator >::dump ( ) const
inline

◆ dump() [2/2]

template<typename T , is_allocator Allocator = malloc_allocator>
void m::doubly_linked_list< T, Allocator >::dump ( std::ostream &  out) const
inline

Definition at line 655 of file ADT.hpp.

◆ emplace()

template<typename T , is_allocator Allocator = malloc_allocator>
template<typename... Args>
iterator m::doubly_linked_list< T, Allocator >::emplace ( const_iterator  pos,
Args &&...  args 
)
inline

◆ emplace_back()

template<typename T , is_allocator Allocator = malloc_allocator>
template<typename... Args>
reference_type m::doubly_linked_list< T, Allocator >::emplace_back ( Args &&...  args)
inline

◆ emplace_front()

template<typename T , is_allocator Allocator = malloc_allocator>
template<typename... Args>
reference_type m::doubly_linked_list< T, Allocator >::emplace_front ( Args &&...  args)
inline

◆ empty()

template<typename T , is_allocator Allocator = malloc_allocator>
bool m::doubly_linked_list< T, Allocator >::empty ( ) const
inline

◆ end() [1/2]

template<typename T , is_allocator Allocator = malloc_allocator>
iterator m::doubly_linked_list< T, Allocator >::end ( )
inline

◆ end() [2/2]

template<typename T , is_allocator Allocator = malloc_allocator>
const_iterator m::doubly_linked_list< T, Allocator >::end ( ) const
inline

Definition at line 511 of file ADT.hpp.

References m::doubly_linked_list< T, Allocator >::tail_.

◆ erase() [1/2]

template<typename T , is_allocator Allocator = malloc_allocator>
iterator m::doubly_linked_list< T, Allocator >::erase ( const_iterator  pos)
inline

◆ erase() [2/2]

template<typename T , is_allocator Allocator = malloc_allocator>
iterator m::doubly_linked_list< T, Allocator >::erase ( iterator  pos)
inline

◆ front() [1/2]

template<typename T , is_allocator Allocator = malloc_allocator>
reference_type m::doubly_linked_list< T, Allocator >::front ( )
inline

◆ front() [2/2]

template<typename T , is_allocator Allocator = malloc_allocator>
const_reference_type m::doubly_linked_list< T, Allocator >::front ( ) const
inline

◆ get_allocator()

template<typename T , is_allocator Allocator = malloc_allocator>
allocator_type & m::doubly_linked_list< T, Allocator >::get_allocator ( ) const
inlinenoexcept

Definition at line 499 of file ADT.hpp.

References m::doubly_linked_list< T, Allocator >::allocator_.

◆ insert() [1/5]

template<typename T , is_allocator Allocator = malloc_allocator>
iterator m::doubly_linked_list< T, Allocator >::insert ( const_iterator  pos,
const value_type value 
)
inline

◆ insert() [2/5]

template<typename T , is_allocator Allocator = malloc_allocator>
template<typename InputIt , typename = decltype(*std::declval<InputIt&>(), std::declval<InputIt&>()++, void())>
iterator m::doubly_linked_list< T, Allocator >::insert ( const_iterator  pos,
InputIt  first,
InputIt  last 
)
inline

◆ insert() [3/5]

template<typename T , is_allocator Allocator = malloc_allocator>
iterator m::doubly_linked_list< T, Allocator >::insert ( const_iterator  pos,
size_type  count,
const value_type value 
)
inline

◆ insert() [4/5]

template<typename T , is_allocator Allocator = malloc_allocator>
iterator m::doubly_linked_list< T, Allocator >::insert ( const_iterator  pos,
std::initializer_list< value_type ilist 
)
inline

Definition at line 587 of file ADT.hpp.

References m::doubly_linked_list< T, Allocator >::insert().

◆ insert() [5/5]

template<typename T , is_allocator Allocator = malloc_allocator>
iterator m::doubly_linked_list< T, Allocator >::insert ( const_iterator  pos,
value_type &&  value 
)
inline

Definition at line 566 of file ADT.hpp.

References m::doubly_linked_list< T, Allocator >::emplace().

◆ max_size()

template<typename T , is_allocator Allocator = malloc_allocator>
size_type m::doubly_linked_list< T, Allocator >::max_size ( ) const
inline

Definition at line 525 of file ADT.hpp.

◆ operator=()

template<typename T , is_allocator Allocator = malloc_allocator>
doubly_linked_list & m::doubly_linked_list< T, Allocator >::operator= ( doubly_linked_list< T, Allocator >  other)
inline

Definition at line 497 of file ADT.hpp.

References m::doubly_linked_list< T, Allocator >::swap.

◆ pop_back()

template<typename T , is_allocator Allocator = malloc_allocator>
value_type m::doubly_linked_list< T, Allocator >::pop_back ( )
inline

◆ pop_front()

template<typename T , is_allocator Allocator = malloc_allocator>
value_type m::doubly_linked_list< T, Allocator >::pop_front ( )
inline

◆ push_back() [1/2]

template<typename T , is_allocator Allocator = malloc_allocator>
void m::doubly_linked_list< T, Allocator >::push_back ( const value_type value)
inline

◆ push_back() [2/2]

template<typename T , is_allocator Allocator = malloc_allocator>
void m::doubly_linked_list< T, Allocator >::push_back ( value_type &&  value)
inline

Definition at line 561 of file ADT.hpp.

References m::doubly_linked_list< T, Allocator >::emplace_back().

◆ push_front() [1/2]

template<typename T , is_allocator Allocator = malloc_allocator>
void m::doubly_linked_list< T, Allocator >::push_front ( const value_type value)
inline

Definition at line 562 of file ADT.hpp.

References m::doubly_linked_list< T, Allocator >::emplace_front().

◆ push_front() [2/2]

template<typename T , is_allocator Allocator = malloc_allocator>
void m::doubly_linked_list< T, Allocator >::push_front ( value_type &&  value)
inline

Definition at line 563 of file ADT.hpp.

References m::doubly_linked_list< T, Allocator >::emplace_front().

◆ rbegin() [1/2]

template<typename T , is_allocator Allocator = malloc_allocator>
iterator m::doubly_linked_list< T, Allocator >::rbegin ( )
inline

◆ rbegin() [2/2]

template<typename T , is_allocator Allocator = malloc_allocator>
const_iterator m::doubly_linked_list< T, Allocator >::rbegin ( ) const
inline

Definition at line 517 of file ADT.hpp.

References m::doubly_linked_list< T, Allocator >::tail_.

◆ rend() [1/2]

template<typename T , is_allocator Allocator = malloc_allocator>
iterator m::doubly_linked_list< T, Allocator >::rend ( )
inline

◆ rend() [2/2]

template<typename T , is_allocator Allocator = malloc_allocator>
const_iterator m::doubly_linked_list< T, Allocator >::rend ( ) const
inline

Definition at line 518 of file ADT.hpp.

References m::doubly_linked_list< T, Allocator >::head_.

◆ reverse()

template<typename T , is_allocator Allocator = malloc_allocator>
void m::doubly_linked_list< T, Allocator >::reverse ( )
inline

◆ size()

template<typename T , is_allocator Allocator = malloc_allocator>
size_type m::doubly_linked_list< T, Allocator >::size ( ) const
inline

Friends And Related Function Documentation

◆ operator<<

template<typename T , is_allocator Allocator = malloc_allocator>
M_LCOV_EXCL_START friend std::ostream & operator<< ( std::ostream &  out,
const doubly_linked_list< T, Allocator > &  L 
)
friend

Definition at line 634 of file ADT.hpp.

◆ swap

template<typename T , is_allocator Allocator = malloc_allocator>
void swap ( doubly_linked_list< T, Allocator > &  first,
doubly_linked_list< T, Allocator > &  second 
)
friend

◆ to_string

template<typename T , is_allocator Allocator = malloc_allocator>
std::string to_string ( const doubly_linked_list< T, Allocator > &  L)
friend

Definition at line 649 of file ADT.hpp.

Field Documentation

◆ allocator_

template<typename T , is_allocator Allocator = malloc_allocator>
allocator_type m::doubly_linked_list< T, Allocator >::allocator_
mutableprivate

◆ head_

template<typename T , is_allocator Allocator = malloc_allocator>
node_type* m::doubly_linked_list< T, Allocator >::head_ = nullptr
private

◆ size_

template<typename T , is_allocator Allocator = malloc_allocator>
size_type m::doubly_linked_list< T, Allocator >::size_ = 0
private

◆ tail_

template<typename T , is_allocator Allocator = malloc_allocator>
node_type* m::doubly_linked_list< T, Allocator >::tail_ = nullptr
private

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