aGrUM  0.16.0
gum::ListBucket< Val > Class Template Reference

Bucket for a chained list. More...

#include <agrum/core/list.h>

Public Member Functions

template<typename... Args>
INLINE ListBucket (typename ListBucket< Val >::Emplace, Args &&... args)
 
Constructors / Destructors
 ListBucket ()=delete
 Removes empty constructor. More...
 
 ListBucket (const Val &v)
 Default constructor. More...
 
 ListBucket (Val &&v) noexcept
 Constructor for Val rvalues. More...
 
template<typename... Args>
 ListBucket (Emplace, Args &&... args)
 Emplace (universal) constructor. More...
 
 ListBucket (const ListBucket< Val > &src)
 Copy constructor. More...
 
 ListBucket (ListBucket< Val > &&src)=delete
 Move constructor should be useless. More...
 
 ~ListBucket ()
 Class destructor. More...
 
Operators
ListBucket< Val > & operator= (const ListBucket< Val > &src)
 Copy operator. More...
 
ListBucket< Val > & operator= (ListBucket< Val > &&src)=delete
 Move operator. More...
 
bool operator== (const ListBucket< Val > &src) const
 Equality check. More...
 
bool operator!= (const ListBucket< Val > &src) const
 Inequality check. More...
 
Accessors / Modifiers
Val & operator* () noexcept
 Dereferencing operator. More...
 
const Val & operator* () const noexcept
 Dereferencing operator. More...
 
const ListBucket< Val > * next () const noexcept
 Returns the bucket toward the next element. More...
 
const ListBucket< Val > * previous () const noexcept
 Returns the bucket toward the preceding element. More...
 

Friends

template<typename T , typename A >
class List
 All the list containers and iterators should be able to access the buckets. More...
 
class ListIterator< Val >
 
class ListConstIterator< Val >
 
class ListIteratorSafe< Val >
 
class ListConstIteratorSafe< Val >
 

Detailed Description

template<typename Val>
class gum::ListBucket< Val >

Bucket for a chained list.

In aGrUM, each box of a chained list is called a bucket. Lists are doubly linked bucket lists so as to enable efficient rbegin/rend iterators.

Warning
Values stored in buckets are ALWAYS COPIES.
Template Parameters
ValThe values type stored in the gum::ListBucket.

Definition at line 105 of file list.h.

Member Enumeration Documentation

◆ Emplace

template<typename Val>
enum gum::ListBucket::Emplace
strongprivate

C dummy type for the emplace constructor.

This type is used to prevent the list emplace (int) to compile.

Enumerator
EMPLACE 

Definition at line 112 of file list.h.

112 { EMPLACE };

Constructor & Destructor Documentation

◆ ListBucket() [1/7]

template<typename Val>
gum::ListBucket< Val >::ListBucket ( )
delete

Removes empty constructor.

◆ ListBucket() [2/7]

template<typename Val>
INLINE gum::ListBucket< Val >::ListBucket ( const Val &  v)
explicit

Default constructor.

Parameters
vThe value stored in the gum::ListBucket.

Definition at line 43 of file list_tpl.h.

43  : __val{v} {
44  // for debugging purposes
45  GUM_CONSTRUCTOR(ListBucket);
46  }
ListBucket()=delete
Removes empty constructor.
Val __val
Val is the value contained in the box.
Definition: list.h:249

◆ ListBucket() [3/7]

template<typename Val>
INLINE gum::ListBucket< Val >::ListBucket ( Val &&  v)
explicitnoexcept

Constructor for Val rvalues.

Parameters
vThe value stored in the gum::ListBucket.

Definition at line 50 of file list_tpl.h.

50  : __val{std::move(v)} {
51  // for debugging purposes
52  GUM_CONSTRUCTOR(ListBucket);
53  }
ListBucket()=delete
Removes empty constructor.
Val __val
Val is the value contained in the box.
Definition: list.h:249

◆ ListBucket() [4/7]

template<typename Val>
template<typename... Args>
gum::ListBucket< Val >::ListBucket ( Emplace  ,
Args &&...  args 
)
explicit

Emplace (universal) constructor.

Template Parameters
ArgsThe emplace values type.
Parameters
argsThe emplace values.

◆ ListBucket() [5/7]

template<typename Val>
INLINE gum::ListBucket< Val >::ListBucket ( const ListBucket< Val > &  src)

Copy constructor.

Parameters
srcThe gum::ListBucket to copy.

Definition at line 67 of file list_tpl.h.

67  :
68  __val{src.__val} {
69  // for debugging purposes
70  GUM_CONS_CPY(ListBucket);
71  }
ListBucket()=delete
Removes empty constructor.
Val __val
Val is the value contained in the box.
Definition: list.h:249

◆ ListBucket() [6/7]

template<typename Val>
gum::ListBucket< Val >::ListBucket ( ListBucket< Val > &&  src)
delete

Move constructor should be useless.

Parameters
srcThe gum::ListBucket to move.

◆ ~ListBucket()

template<typename Val >
INLINE gum::ListBucket< Val >::~ListBucket ( )

Class destructor.

Warning
during its deletion, the bucket takes care of properly rechaining the chained list. However, it has no knowledge about the variables that keep track of the beginning/end of the chained list, hence it cannot update them properly. This should be done by the List itself.

Definition at line 88 of file list_tpl.h.

88  {
89  // for debugging purposes
90  GUM_DESTRUCTOR(ListBucket);
91  }
ListBucket()=delete
Removes empty constructor.

◆ ListBucket() [7/7]

template<typename Val>
template<typename... Args>
INLINE gum::ListBucket< Val >::ListBucket ( typename ListBucket< Val >::Emplace  ,
Args &&...  args 
)

Definition at line 58 of file list_tpl.h.

59  :
60  __val(std::forward< Args >(args)...) {
61  // for debugging purposes
62  GUM_CONSTRUCTOR(ListBucket);
63  }
ListBucket()=delete
Removes empty constructor.
Val __val
Val is the value contained in the box.
Definition: list.h:249

Member Function Documentation

◆ next()

template<typename Val >
INLINE const ListBucket< Val > * gum::ListBucket< Val >::next ( ) const
noexcept

Returns the bucket toward the next element.

Returns
Returns the bucket toward the next element.

Definition at line 119 of file list_tpl.h.

119  {
120  return __next;
121  }
ListBucket< Val > * __next
Chaining toward the adjacent elements.
Definition: list.h:245

◆ operator!=()

template<typename Val>
INLINE bool gum::ListBucket< Val >::operator!= ( const ListBucket< Val > &  src) const

Inequality check.

Parameters
srcThe gum::ListBucket to test for inequality.
Returns
Returns true if src and this gum::ListBucket are not equal.

Definition at line 101 of file list_tpl.h.

101  {
102  return (src.__val != __val);
103  }
Val __val
Val is the value contained in the box.
Definition: list.h:249

◆ operator*() [1/2]

template<typename Val >
INLINE Val & gum::ListBucket< Val >::operator* ( )
noexcept

Dereferencing operator.

Returns
The value stored in this gum::ListBucket.

Definition at line 113 of file list_tpl.h.

113  {
114  return __val;
115  }
Val __val
Val is the value contained in the box.
Definition: list.h:249

◆ operator*() [2/2]

template<typename Val >
INLINE const Val & gum::ListBucket< Val >::operator* ( ) const
noexcept

Dereferencing operator.

Returns
The value stored in this gum::ListBucket.

Definition at line 107 of file list_tpl.h.

107  {
108  return __val;
109  }
Val __val
Val is the value contained in the box.
Definition: list.h:249

◆ operator=() [1/2]

template<typename Val>
INLINE ListBucket< Val > & gum::ListBucket< Val >::operator= ( const ListBucket< Val > &  src)

Copy operator.

Parameters
srcThe gum::ListBucket to copy.
Returns
This gum::ListBucket.

Definition at line 76 of file list_tpl.h.

76  {
77  // for debugging purposes
78  GUM_OP_CPY(ListBucket);
79 
80  // no need to avoid self assignment
81  __val = src.__val;
82  return *this;
83  }
ListBucket()=delete
Removes empty constructor.
Val __val
Val is the value contained in the box.
Definition: list.h:249

◆ operator=() [2/2]

template<typename Val>
ListBucket< Val >& gum::ListBucket< Val >::operator= ( ListBucket< Val > &&  src)
delete

Move operator.

Parameters
srcThe gum::ListBucket to move.
Returns
This gum::ListBucket.

◆ operator==()

template<typename Val>
INLINE bool gum::ListBucket< Val >::operator== ( const ListBucket< Val > &  src) const

Equality check.

Parameters
srcThe gum::ListBucket to test for equality.
Returns
Returns true if src and this gum::ListBucket are equal.

Definition at line 95 of file list_tpl.h.

95  {
96  return (src.__val == __val);
97  }
Val __val
Val is the value contained in the box.
Definition: list.h:249

◆ previous()

template<typename Val >
INLINE const ListBucket< Val > * gum::ListBucket< Val >::previous ( ) const
noexcept

Returns the bucket toward the preceding element.

Returns
Returns the bucket toward the preceding element.

Definition at line 125 of file list_tpl.h.

125  {
126  return __prev;
127  }
ListBucket< Val > * __prev
Chaining toward the adjacent elements.
Definition: list.h:244

Friends And Related Function Documentation

◆ List

template<typename Val>
template<typename T , typename A >
friend class List
friend

All the list containers and iterators should be able to access the buckets.

Definition at line 236 of file list.h.

◆ ListConstIterator< Val >

template<typename Val>
friend class ListConstIterator< Val >
friend

Definition at line 238 of file list.h.

◆ ListConstIteratorSafe< Val >

template<typename Val>
friend class ListConstIteratorSafe< Val >
friend

Definition at line 240 of file list.h.

◆ ListIterator< Val >

template<typename Val>
friend class ListIterator< Val >
friend

Definition at line 237 of file list.h.

◆ ListIteratorSafe< Val >

template<typename Val>
friend class ListIteratorSafe< Val >
friend

Definition at line 239 of file list.h.

Member Data Documentation

◆ __next

◆ __prev

◆ __val


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