Ultra 0.9.4
Loading...
Searching...
No Matches
ultra::layered_population< I >::base_iterator< is_const > Class Template Reference

#include <layered_population.h>

Public Types

using iterator_category = std::forward_iterator_tag
using value_type = I
using pointer = value_type *
using const_pointer = const value_type *
using reference = value_type &
using const_reference = const value_type &
using difference_type = std::ptrdiff_t
using ptr = std::conditional_t<is_const, const_pointer, pointer>
using ref = std::conditional_t<is_const, const_reference, reference>
using pop
using itr

Public Member Functions

 base_iterator (pop &p, bool begin) noexcept
base_iterator & operator++ () noexcept
base_iterator operator++ (int) noexcept
bool operator== (const base_iterator &other) const noexcept
std::size_t uid () const noexcept
layered_population< I >::coord coord () const noexcept
ref operator* () const noexcept
ptr operator-> () const noexcept

Friends

std::ostream & operator<< (std::ostream &out, const base_iterator &i)

Detailed Description

template<Individual I>
template<bool is_const>
class ultra::layered_population< I >::base_iterator< is_const >

Iterator for scanning individuals of a layered population.

Member Typedef Documentation

◆ itr

template<Individual I>
template<bool is_const>
using ultra::layered_population< I >::base_iterator< is_const >::itr
Initial value:
std::conditional_t<is_const,
typename pop::layer_const_iter,
typename pop::layer_iter>

◆ pop

template<Individual I>
template<bool is_const>
using ultra::layered_population< I >::base_iterator< is_const >::pop
Initial value:
std::conditional_t<is_const,
const layered_population, layered_population>

Constructor & Destructor Documentation

◆ base_iterator()

template<Individual I>
template<bool is_const>
ultra::layered_population< I >::base_iterator< is_const >::base_iterator ( pop & p,
bool begin )
inlinenoexcept
Parameters
[in]pa population
[in]beginfalse for the end() iterator

Member Function Documentation

◆ operator*()

template<Individual I>
template<bool is_const>
ref ultra::layered_population< I >::base_iterator< is_const >::operator* ( ) const
inlinenodiscardnoexcept
Returns
reference to the current individual

◆ operator++() [1/2]

template<Individual I>
template<bool is_const>
base_iterator & ultra::layered_population< I >::base_iterator< is_const >::operator++ ( )
inlinenoexcept

Prefix increment operator.

Returns
iterator to the next individual
Warning
Advancing past the end() iterator results in undefined behaviour.

◆ operator++() [2/2]

template<Individual I>
template<bool is_const>
base_iterator ultra::layered_population< I >::base_iterator< is_const >::operator++ ( int )
inlinenoexcept

Postfix increment operator.

Returns
iterator to the current individual

◆ operator->()

template<Individual I>
template<bool is_const>
ptr ultra::layered_population< I >::base_iterator< is_const >::operator-> ( ) const
inlinenodiscardnoexcept
Returns
pointer to the current individual

◆ operator==()

template<Individual I>
template<bool is_const>
bool ultra::layered_population< I >::base_iterator< is_const >::operator== ( const base_iterator< is_const > & other) const
inlinenodiscardnoexcept
Returns
true if iterators point to corresponding individuals

Equality is intentionally defined only in terms of the current layer iterator and offset within that layer. We do not default this comparison because cached implementation details that do not identify the position could make two independently-created iterators to the same individual compare unequal, violating the multi-pass guarantee required by forward iterators.


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