mCRL2
Loading...
Searching...
No Matches
mcrl2::utilities::detail::bucket_list< Key, Allocator > Class Template Reference

This essentially implements the std::forward_list, with the difference that it does not own the nodes in the list. It just keeps track of the list next pointers. More...

#include <bucket_list.h>

Classes

class  key_iterator
 Iterator over all keys in a bucket list. More...
 
class  node
 The nodes of the bucket list. More...
 
class  node_base
 The nodes of the bucket list without carrying any additional informations. Used to make no different between the head and the tail of the list. More...
 

Public Types

using Bucket = bucket_list< Key, Allocator >
 
using iterator = key_iterator< false >
 
using const_iterator = key_iterator< true >
 
using NodeAllocator = typename std::allocator_traits< Allocator >::template rebind_alloc< Bucket::node >
 Rebind the passed to allocator to a bucket list node allocator.
 

Public Member Functions

Key & front ()
 
const Key & front () const
 
iterator begin ()
 
iterator end ()
 
iterator before_begin ()
 
const_iterator begin () const
 
const_iterator end () const
 
const_iterator cbegin () const
 
const_iterator cend () const
 
const_iterator before_begin () const
 
bool empty () const
 
void clear (NodeAllocator &allocator)
 Empties the bucket list.
 
template<typename ... Args>
void emplace_front (NodeAllocator &allocator, Args &&...args)
 Constructs an element using the allocator with the given arguments and insert it in the front.
 
template<typename ... Args, typename Equals >
std::pair< iterator, bool > emplace_front_unique (NodeAllocator &allocator, const Equals &equals, Args &&...args)
 Constructs an element using the allocator with the given arguments and insert it in the front of the bucket iff it does not already exist.
 
iterator erase_after (NodeAllocator &allocator, const_iterator it)
 Removes the element after the given iterator from the list. The returned iterator.
 
void splice_after (const_iterator pos, bucket_list &other)
 Moves the elements from other into this bucket after the given position.
 
void splice_front (const_iterator pos, bucket_list &other)
 Moves the first node from the given bucket into this bucket after the given position.
 

Private Member Functions

bool contains (node *node)
 

Private Attributes

node_base m_head
 The first node in the bucket list.
 

Detailed Description

template<typename Key, typename Allocator>
class mcrl2::utilities::detail::bucket_list< Key, Allocator >

This essentially implements the std::forward_list, with the difference that it does not own the nodes in the list. It just keeps track of the list next pointers.

Definition at line 47 of file bucket_list.h.

Member Typedef Documentation

◆ Bucket

template<typename Key , typename Allocator >
using mcrl2::utilities::detail::bucket_list< Key, Allocator >::Bucket = bucket_list<Key, Allocator>

Definition at line 179 of file bucket_list.h.

◆ const_iterator

template<typename Key , typename Allocator >
using mcrl2::utilities::detail::bucket_list< Key, Allocator >::const_iterator = key_iterator<true>

Definition at line 181 of file bucket_list.h.

◆ iterator

template<typename Key , typename Allocator >
using mcrl2::utilities::detail::bucket_list< Key, Allocator >::iterator = key_iterator<false>

Definition at line 180 of file bucket_list.h.

◆ NodeAllocator

template<typename Key , typename Allocator >
using mcrl2::utilities::detail::bucket_list< Key, Allocator >::NodeAllocator = typename std::allocator_traits<Allocator>::template rebind_alloc<Bucket::node>

Rebind the passed to allocator to a bucket list node allocator.

Definition at line 184 of file bucket_list.h.

Member Function Documentation

◆ before_begin() [1/2]

template<typename Key , typename Allocator >
iterator mcrl2::utilities::detail::bucket_list< Key, Allocator >::before_begin ( )
inline
Returns
An iterator pointing to the before the head of the list.

Definition at line 195 of file bucket_list.h.

◆ before_begin() [2/2]

template<typename Key , typename Allocator >
const_iterator mcrl2::utilities::detail::bucket_list< Key, Allocator >::before_begin ( ) const
inline
Returns
A const iterator pointing to the before the head of the list.

Definition at line 205 of file bucket_list.h.

◆ begin() [1/2]

template<typename Key , typename Allocator >
iterator mcrl2::utilities::detail::bucket_list< Key, Allocator >::begin ( )
inline
Returns
An iterator over the keys of this bucket and successor buckets.

Definition at line 191 of file bucket_list.h.

◆ begin() [2/2]

template<typename Key , typename Allocator >
const_iterator mcrl2::utilities::detail::bucket_list< Key, Allocator >::begin ( ) const
inline
Returns
A const iterator over the keys of this bucket and successor buckets.

Definition at line 198 of file bucket_list.h.

◆ cbegin()

template<typename Key , typename Allocator >
const_iterator mcrl2::utilities::detail::bucket_list< Key, Allocator >::cbegin ( ) const
inline

Definition at line 201 of file bucket_list.h.

◆ cend()

template<typename Key , typename Allocator >
const_iterator mcrl2::utilities::detail::bucket_list< Key, Allocator >::cend ( ) const
inline

Definition at line 202 of file bucket_list.h.

◆ clear()

template<typename Key , typename Allocator >
void mcrl2::utilities::detail::bucket_list< Key, Allocator >::clear ( NodeAllocator allocator)
inline

Empties the bucket list.

Definition at line 211 of file bucket_list.h.

◆ contains()

template<typename Key , typename Allocator >
bool mcrl2::utilities::detail::bucket_list< Key, Allocator >::contains ( node node)
inlineprivate
Returns
True iff this bucket already contains the given node.

Definition at line 355 of file bucket_list.h.

◆ emplace_front()

template<typename Key , typename Allocator >
template<typename ... Args>
void mcrl2::utilities::detail::bucket_list< Key, Allocator >::emplace_front ( NodeAllocator allocator,
Args &&...  args 
)
inline

Constructs an element using the allocator with the given arguments and insert it in the front.

Definition at line 221 of file bucket_list.h.

◆ emplace_front_unique()

template<typename Key , typename Allocator >
template<typename ... Args, typename Equals >
std::pair< iterator, bool > mcrl2::utilities::detail::bucket_list< Key, Allocator >::emplace_front_unique ( NodeAllocator allocator,
const Equals &  equals,
Args &&...  args 
)
inline

Constructs an element using the allocator with the given arguments and insert it in the front of the bucket iff it does not already exist.

Returns
True iff the insertion took place. \threadsafe

Definition at line 239 of file bucket_list.h.

◆ empty()

template<typename Key , typename Allocator >
bool mcrl2::utilities::detail::bucket_list< Key, Allocator >::empty ( ) const
inline
Returns
True iff this bucket has no elements.

Definition at line 208 of file bucket_list.h.

◆ end() [1/2]

template<typename Key , typename Allocator >
iterator mcrl2::utilities::detail::bucket_list< Key, Allocator >::end ( )
inline

Definition at line 192 of file bucket_list.h.

◆ end() [2/2]

template<typename Key , typename Allocator >
const_iterator mcrl2::utilities::detail::bucket_list< Key, Allocator >::end ( ) const
inline

Definition at line 199 of file bucket_list.h.

◆ erase_after()

template<typename Key , typename Allocator >
iterator mcrl2::utilities::detail::bucket_list< Key, Allocator >::erase_after ( NodeAllocator allocator,
const_iterator  it 
)
inline

Removes the element after the given iterator from the list. The returned iterator.

Definition at line 276 of file bucket_list.h.

◆ front() [1/2]

template<typename Key , typename Allocator >
Key & mcrl2::utilities::detail::bucket_list< Key, Allocator >::front ( )
inline
Returns
The first element.

Definition at line 187 of file bucket_list.h.

◆ front() [2/2]

template<typename Key , typename Allocator >
const Key & mcrl2::utilities::detail::bucket_list< Key, Allocator >::front ( ) const
inline

Definition at line 188 of file bucket_list.h.

◆ splice_after()

template<typename Key , typename Allocator >
void mcrl2::utilities::detail::bucket_list< Key, Allocator >::splice_after ( const_iterator  pos,
bucket_list< Key, Allocator > &  other 
)
inline

Moves the elements from other into this bucket after the given position.

Definition at line 296 of file bucket_list.h.

◆ splice_front()

template<typename Key , typename Allocator >
void mcrl2::utilities::detail::bucket_list< Key, Allocator >::splice_front ( const_iterator  pos,
bucket_list< Key, Allocator > &  other 
)
inline

Moves the first node from the given bucket into this bucket after the given position.

This is a non-standard addition to ensure efficient splicing (instead of splice_after(pos, other, other.begin(), ++other.begin()).

Definition at line 331 of file bucket_list.h.

Member Data Documentation

◆ m_head

template<typename Key , typename Allocator >
node_base mcrl2::utilities::detail::bucket_list< Key, Allocator >::m_head
private

The first node in the bucket list.

Definition at line 372 of file bucket_list.h.


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