MySQL 8.3.0
Source Code Documentation
NextFunctionIterator< T, GetNextPointer > Class Template Reference

An iterator that follows a 'next' pointer with an accessor function. More...

#include <intrusive_list_iterator.h>

Public Types

using value_type = T *
 

Public Member Functions

 NextFunctionIterator (T *start)
 Constructs an iterator. More...
 
 NextFunctionIterator ()
 Constructs a past-the-end iterator. More...
 
NextFunctionIteratoroperator++ ()
 
NextFunctionIterator operator++ (int)
 
T * operator* () const
 
bool operator== (const NextFunctionIterator &other) const
 
bool operator!= (const NextFunctionIterator &other) const
 

Private Attributes

T * m_current
 

Detailed Description

template<typename T, T *(*)(const T *) GetNextPointer>
class NextFunctionIterator< T, GetNextPointer >

An iterator that follows a 'next' pointer with an accessor function.

Template Parameters
TThe type of the object holding the intrusive list.
GetNextPointerThe accessor function, returning a pointer to the next object in the list.
Note
Due to the nature of intrusive 'next' pointers it's not possible to free an intrusive pointee while iterating over an intrusive list with the pre-increment operator, as the enhanced for-loop does, e.g.
for(auto elem : elems)
delete *elem;

Will cause a core dump. However, the following is possible:

auto it = container.begin();
while(it != container.end()) delete *(it++);
Definition: atomics_array.h:38

Member Typedef Documentation

◆ value_type

template<typename T , T *(*)(const T *) GetNextPointer>
using NextFunctionIterator< T, GetNextPointer >::value_type = T *

Constructor & Destructor Documentation

◆ NextFunctionIterator() [1/2]

template<typename T , T *(*)(const T *) GetNextPointer>
NextFunctionIterator< T, GetNextPointer >::NextFunctionIterator ( T *  start)
inlineexplicit

Constructs an iterator.

Parameters
startThe object that the iterator will start iterating from.

◆ NextFunctionIterator() [2/2]

template<typename T , T *(*)(const T *) GetNextPointer>
NextFunctionIterator< T, GetNextPointer >::NextFunctionIterator ( )
inline

Constructs a past-the-end iterator.

Member Function Documentation

◆ operator!=()

template<typename T , T *(*)(const T *) GetNextPointer>
bool NextFunctionIterator< T, GetNextPointer >::operator!= ( const NextFunctionIterator< T, GetNextPointer > &  other) const
inline

◆ operator*()

template<typename T , T *(*)(const T *) GetNextPointer>
T * NextFunctionIterator< T, GetNextPointer >::operator* ( ) const
inline

◆ operator++() [1/2]

template<typename T , T *(*)(const T *) GetNextPointer>
NextFunctionIterator & NextFunctionIterator< T, GetNextPointer >::operator++ ( )
inline

◆ operator++() [2/2]

template<typename T , T *(*)(const T *) GetNextPointer>
NextFunctionIterator NextFunctionIterator< T, GetNextPointer >::operator++ ( int  )
inline

◆ operator==()

template<typename T , T *(*)(const T *) GetNextPointer>
bool NextFunctionIterator< T, GetNextPointer >::operator== ( const NextFunctionIterator< T, GetNextPointer > &  other) const
inline

Member Data Documentation

◆ m_current

template<typename T , T *(*)(const T *) GetNextPointer>
T* NextFunctionIterator< T, GetNextPointer >::m_current
private

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