CGAL 6.1.1 - Handles and Circulators

Loading...
Searching...
No Matches
List of all members
CGAL::Circulator_traits< C > Struct Template Reference
Reference Manual

`#include <CGAL/circulator.h>`

## Definition

template<typename C>
struct CGAL::Circulator_traits< C >

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`.

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());
}
unspecified_type
CGAL::Assert_iterator
void Assert_iterator(const I &i)
checks at compile time if its argument is an iterator.
CGAL::Assert_circulator
void Assert_circulator(const C &c)
checks at compile time if its argument is a circulator.
CGAL::Circulator_tag
A tag for any circulator type.
Definition: circulator_bases.h:53
CGAL::Iterator_tag
A tag for any iterator type.
Definition: circulator_bases.h:59

Examples
  Circulator/circulator_prog3.cpp.

## Types
typedef unspecified_type | category
| either `Iterator_tag` or `Circulator_tag`.
typedef unspecified_type | iterator_category
| corresponding iterator category for circulators.
typedef unspecified_type | circulator_category
| corresponding circulator category for iterator.