dune-common 2.11
Loading...
Searching...
No Matches
Dune::DefaultIteratorTraits< IteratorCategory, Reference, DifferenceType > Struct Template Reference

An iterator_traits class providing sensible defaults. More...

#include <dune/common/iteratorfacades.hh>

Public Types

using iterator_category = IteratorCategory
using reference = Reference
using value_type = Dune::AutonomousValue<reference>
using pointer = std::conditional_t<std::is_lvalue_reference_v<reference>, value_type*, Dune::ProxyArrowResult<reference>>
using difference_type = DifferenceType

Detailed Description

template<class IteratorCategory, class Reference, class DifferenceType = std::ptrdiff_t>
struct Dune::DefaultIteratorTraits< IteratorCategory, Reference, DifferenceType >

An iterator_traits class providing sensible defaults.

Template Parameters
IteratorCategoryCategory of the iterator, e.g. std::forward_iterator_tag
ReferenceReference type returns when dereferencing the iterator

This provides default types for value_type, pointer, and difference_type that should work for most iterator implementations including proxy iterators where the proxy types implement the Dune::AutonomousValue mechanism. The value_type is derived as Dune::AutonomousValue<reference>. The pointer type is a plain value_type* pointer if the reference is an l-value reference. Otherwise Dune::ProxyArrowResult<reference> is used to provide a suitable return type for operator-> for proxies.

Member Typedef Documentation

◆ difference_type

template<class IteratorCategory, class Reference, class DifferenceType = std::ptrdiff_t>
using Dune::DefaultIteratorTraits< IteratorCategory, Reference, DifferenceType >::difference_type = DifferenceType

◆ iterator_category

template<class IteratorCategory, class Reference, class DifferenceType = std::ptrdiff_t>
using Dune::DefaultIteratorTraits< IteratorCategory, Reference, DifferenceType >::iterator_category = IteratorCategory

◆ pointer

template<class IteratorCategory, class Reference, class DifferenceType = std::ptrdiff_t>
using Dune::DefaultIteratorTraits< IteratorCategory, Reference, DifferenceType >::pointer = std::conditional_t<std::is_lvalue_reference_v<reference>, value_type*, Dune::ProxyArrowResult<reference>>

◆ reference

template<class IteratorCategory, class Reference, class DifferenceType = std::ptrdiff_t>
using Dune::DefaultIteratorTraits< IteratorCategory, Reference, DifferenceType >::reference = Reference

◆ value_type

template<class IteratorCategory, class Reference, class DifferenceType = std::ptrdiff_t>
using Dune::DefaultIteratorTraits< IteratorCategory, Reference, DifferenceType >::value_type = Dune::AutonomousValue<reference>

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