CGAL::Circulator_traits<C>

Definition

The circulator traits class distinguishes between circulators and iterators. It defines a local type category that is identical to the type Circulator_tag if the iterator category of the argument C is a circulator category. Otherwise it is identical to the type Iterator_tag.

The local type iterator_category gives the corresponding iterator category for circulators, i.e. one of forward_iterator_tag, bidirectional_iterator_tag, or random_access_iterator_tag.

The local type circulator_category gives the corresponding circulator category for iterators, i.e. one of Forward_circulator_tag, Bidirectional_circulator_tag, or Random_access_circulator_tag.

#include <CGAL/circulator.h>

Types

Circulator_traits<C>::category
either Iterator_tag or Circulator_tag.


Circulator_traits<C>::iterator_category
corresponding iterator category for circulators.


Circulator_traits<C>::circulator_category
corresponding circulator category for iterator

Example

A generic function bar that distinguishes between a call with a circulator range and a call with an iterator range:

template <class I>
void bar( I i, I j, CGAL::Iterator_tag) {
    CGAL::Assert_iterator(i);
    // This function is called for iterator ranges [i,j).
}
template <class C>
void bar( C c, C d, CGAL::Circulator_tag) {
    CGAL::Assert_circulator(c);
    // This function is called for circulator ranges [c,d).
}
template <class IC>
void bar( IC i, IC j) {  // calls the correct function
    return bar( i, j, typename CGAL::Circulator_traits<IC>::category());
}