aGrUM  0.16.0
gum::learning::IdSetIterator< ALLOC > Class Template Reference

The iterators for IdSets. More...

#include <agrum/learning/scores_and_tests/idSet.h>

Public Member Functions

Constructors / Destructors
 IdSetIterator ()
 default constructor More...
 
 IdSetIterator (const IdSet< ALLOC > &idset)
 Constructor for a begin. More...
 
 IdSetIterator (const IdSetIterator< ALLOC > &from)
 Copy constructor. More...
 
 IdSetIterator (IdSetIterator< ALLOC > &&from)
 move constructor More...
 
virtual ~IdSetIterator ()
 destructor More...
 
Operators
IdSetIterator< ALLOC > & operator= (const IdSetIterator< ALLOC > &from)
 copy operator More...
 
IdSetIterator< ALLOC > & operator= (IdSetIterator< ALLOC > &&from)
 move operator More...
 
NodeId operator* () const
 Gives access to the content of the iterator. More...
 
bool operator!= (const IdSetIterator< ALLOC > &from) const
 Checks whether two iterators point toward different elements. More...
 
bool operator== (const IdSetIterator< ALLOC > &from) const
 Checks whether two iterators point toward the same elements. More...
 
IdSetIterator< ALLOC > & operator++ ()
 Makes the iterator point to the next element in the IdSet. More...
 
IdSetIterator< ALLOC > & operator+= (const std::size_t i)
 Makes the iterator point to i elements further in the IdSet. More...
 
IdSetIterator< ALLOC > operator+ (const std::size_t i)
 Returns a new iterator pointing to i further elements in the IdSet. More...
 
Accessors / Modifiers
std::size_t pos () const
 Returns the position of the iterator in the IdSet. More...
 

Public Types

using iterator_category = std::forward_iterator_tag
 types for STL compliance More...
 
using value_type = NodeId
 types for STL compliance More...
 
using reference = NodeId &
 types for STL compliance More...
 
using const_reference = const NodeId &
 types for STL compliance More...
 
using pointer = NodeId *
 types for STL compliance More...
 
using const_pointer = const NodeId *
 types for STL compliance More...
 
using difference_type = std::ptrdiff_t
 types for STL compliance More...
 

Detailed Description

template<template< typename > class ALLOC = std::allocator>
class gum::learning::IdSetIterator< ALLOC >

The iterators for IdSets.

Definition at line 57 of file idSet.h.

Member Typedef Documentation

◆ const_pointer

template<template< typename > class ALLOC = std::allocator>
using gum::learning::IdSetIterator< ALLOC >::const_pointer = const NodeId*

types for STL compliance

Definition at line 66 of file idSet.h.

◆ const_reference

template<template< typename > class ALLOC = std::allocator>
using gum::learning::IdSetIterator< ALLOC >::const_reference = const NodeId&

types for STL compliance

Definition at line 64 of file idSet.h.

◆ difference_type

template<template< typename > class ALLOC = std::allocator>
using gum::learning::IdSetIterator< ALLOC >::difference_type = std::ptrdiff_t

types for STL compliance

Definition at line 67 of file idSet.h.

◆ iterator_category

template<template< typename > class ALLOC = std::allocator>
using gum::learning::IdSetIterator< ALLOC >::iterator_category = std::forward_iterator_tag

types for STL compliance

Definition at line 61 of file idSet.h.

◆ pointer

template<template< typename > class ALLOC = std::allocator>
using gum::learning::IdSetIterator< ALLOC >::pointer = NodeId*

types for STL compliance

Definition at line 65 of file idSet.h.

◆ reference

template<template< typename > class ALLOC = std::allocator>
using gum::learning::IdSetIterator< ALLOC >::reference = NodeId&

types for STL compliance

Definition at line 63 of file idSet.h.

◆ value_type

template<template< typename > class ALLOC = std::allocator>
using gum::learning::IdSetIterator< ALLOC >::value_type = NodeId

types for STL compliance

Definition at line 62 of file idSet.h.

Constructor & Destructor Documentation

◆ IdSetIterator() [1/4]

template<template< typename > class ALLOC = std::allocator>
gum::learning::IdSetIterator< ALLOC >::IdSetIterator ( )

default constructor

Returns
an iterator pointing toward nothing.

◆ IdSetIterator() [2/4]

template<template< typename > class ALLOC = std::allocator>
gum::learning::IdSetIterator< ALLOC >::IdSetIterator ( const IdSet< ALLOC > &  idset)

Constructor for a begin.

Parameters
idsetThe IdSet to iterate over.

◆ IdSetIterator() [3/4]

template<template< typename > class ALLOC = std::allocator>
gum::learning::IdSetIterator< ALLOC >::IdSetIterator ( const IdSetIterator< ALLOC > &  from)

Copy constructor.

◆ IdSetIterator() [4/4]

template<template< typename > class ALLOC = std::allocator>
gum::learning::IdSetIterator< ALLOC >::IdSetIterator ( IdSetIterator< ALLOC > &&  from)

move constructor

◆ ~IdSetIterator()

template<template< typename > class ALLOC = std::allocator>
virtual gum::learning::IdSetIterator< ALLOC >::~IdSetIterator ( )
virtual

destructor

Member Function Documentation

◆ operator!=()

template<template< typename > class ALLOC = std::allocator>
bool gum::learning::IdSetIterator< ALLOC >::operator!= ( const IdSetIterator< ALLOC > &  from) const

Checks whether two iterators point toward different elements.

◆ operator*()

template<template< typename > class ALLOC = std::allocator>
NodeId gum::learning::IdSetIterator< ALLOC >::operator* ( ) const

Gives access to the content of the iterator.

Exceptions
UndefinedIteratorValueRaised if the iterator points to nothing.
Returns
Returns the content of the iterator.

◆ operator+()

template<template< typename > class ALLOC = std::allocator>
IdSetIterator< ALLOC > gum::learning::IdSetIterator< ALLOC >::operator+ ( const std::size_t  i)

Returns a new iterator pointing to i further elements in the IdSet.

Parameters
iThe number of steps to move the iterator.
Returns
Returns a new gum::IdSetIterator.

◆ operator++()

template<template< typename > class ALLOC = std::allocator>
IdSetIterator< ALLOC >& gum::learning::IdSetIterator< ALLOC >::operator++ ( )

Makes the iterator point to the next element in the IdSet.

for (iter = idset.begin(); iter != idset.end(); ++iter) {}

The above loop is guaranteed to parse the whole IdSet as long as no element is added to or deleted from the IdSet while being in the loop.

Returns
Returns this gum::IdSetIterator.

◆ operator+=()

template<template< typename > class ALLOC = std::allocator>
IdSetIterator< ALLOC >& gum::learning::IdSetIterator< ALLOC >::operator+= ( const std::size_t  i)

Makes the iterator point to i elements further in the IdSet.

Parameters
iThe number of steps to move the iterator.
Returns
Returns this gum::IdSetIterator.

◆ operator=() [1/2]

template<template< typename > class ALLOC = std::allocator>
IdSetIterator< ALLOC >& gum::learning::IdSetIterator< ALLOC >::operator= ( const IdSetIterator< ALLOC > &  from)

copy operator

◆ operator=() [2/2]

template<template< typename > class ALLOC = std::allocator>
IdSetIterator< ALLOC >& gum::learning::IdSetIterator< ALLOC >::operator= ( IdSetIterator< ALLOC > &&  from)

move operator

◆ operator==()

template<template< typename > class ALLOC = std::allocator>
bool gum::learning::IdSetIterator< ALLOC >::operator== ( const IdSetIterator< ALLOC > &  from) const

Checks whether two iterators point toward the same elements.

◆ pos()

template<template< typename > class ALLOC = std::allocator>
std::size_t gum::learning::IdSetIterator< ALLOC >::pos ( ) const

Returns the position of the iterator in the IdSet.

Returns
Returns the position of the iterator in the IdSet.
Exceptions
UndefinedIteratorValueRaised on end()

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