Visual Computing Library
Loading...
Searching...
No Matches
vcl::ConstPointerIterator< It > Class Template Reference

The ConstPointerIterator class is a utility class that wraps an iterator of a container of [shared] pointers, and returns a const [shared] pointer when dereferencing the iterator. More...

#include <vclib/misc/iterators/const_pointer_iterator.h>

Public Types

using difference_type = std::iterator_traits< It >::difference_type
 
using value_type = MakeConstPointerT< typename std::iterator_traits< It >::value_type >
 
using reference = value_type &
 
using pointer = value_type *
 
using iterator_category = std::iterator_traits< It >::iterator_category
 

Public Member Functions

 ConstPointerIterator (It it)
 
value_type operator* () const
 
pointer operator-> () const
 
bool operator== (const ConstPointerIterator &oi) const
 
bool operator!= (const ConstPointerIterator &oi) const
 
ConstPointerIteratoroperator++ ()
 
ConstPointerIterator operator++ (int)
 
ConstPointerIteratoroperator-- ()
 
ConstPointerIterator operator-- (int)
 
ConstPointerIteratoroperator+= (difference_type n)
 
ConstPointerIterator operator+ (difference_type n) const
 
ConstPointerIteratoroperator-= (difference_type n)
 
ConstPointerIterator operator- (difference_type n) const
 
difference_type operator- (const ConstPointerIterator &oi) const
 
value_type operator[] (difference_type n) const
 

Private Types

using Base = It
 

Private Attributes

It mIt
 

Friends

ConstPointerIterator operator+ (difference_type n, const ConstPointerIterator &it)
 

Detailed Description

template<typename It>
requires (IsAnyPointer<typename std::iterator_traits<It>::value_type>)
class vcl::ConstPointerIterator< It >

The ConstPointerIterator class is a utility class that wraps an iterator of a container of [shared] pointers, and returns a const [shared] pointer when dereferencing the iterator.

This iterator is useful in a context where you manage a container of pointers having two iterators:

  • iterator: it allows to modify the pointed objects (not the pointers!)
  • const_iterator: it allows to iterate over the container without modifying the pointed objects. In this scenario, the iterator is easy to define (it is generally an alias to the container's const_iterator), while the const_iterator is a bit more tricky to define. This class allows to define easily the const_iterator:
using const_iterator =
A class representing a line segment in n-dimensional space. The class is parameterized by a PointConc...
Definition segment.h:43
Template Parameters
ItThe iterator type.

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