CGAL 4.6.1 - Handles and Circulators
|
Macros | |
#define | CGAL_For_all(i, j) |
In order to write algorithms that work with iterator ranges as well as with circulator ranges we have to consider the difference of representing an empty range. More... | |
#define | CGAL_For_all_backwards(i, j) |
See CGAL_For_all. | |
Functions | |
template<class C > | |
C::difference_type | CGAL::circulator_distance (C c, C d) |
The distance of a circulator c to a circulator d is the number of elements in the range [c, d) . More... | |
template<class C > | |
C::size_type | CGAL::circulator_size (C c) |
The size of a circulator is the size of the data structure it refers to. More... | |
template<class IC > | |
bool | CGAL::is_empty_range (const IC &i, const IC &j) |
is true if the range [i, j) is empty, false otherwise. More... | |
template<class IC > | |
iterator_traits< IC > ::difference_type | CGAL::iterator_distance (IC ic1, IC ic2) |
The following function returns the distance between either two iterators or two circulators. More... | |
template<class I > | |
Iterator_tag | CGAL::query_circulator_or_iterator (const I &i) |
This function matches for type I if the iterator category of I belongs to an iterator. More... | |
template<class C > | |
Circulator_tag | CGAL::query_circulator_or_iterator (const C &c) |
This functiona matches for type C if the iterator category of C belongs to a circulator. More... | |
#define CGAL_For_all | ( | i, | |
j | |||
) |
In order to write algorithms that work with iterator ranges as well as with circulator ranges we have to consider the difference of representing an empty range.
For iterators this is the range [i,i)
, while for circulators it would be c == NULL
, the empty sequence test. The function is_empty_range()
provides the necessary generic test which accepts an iterator range or a circulator range and says whether the range is empty or not.
A macro CGAL_For_all( i, j)
simplifies the writing of such simple loops as the one in the example of the function is_empty_range()
. i
and j
can be either iterators or circulators. The macro loops through the range [i, j)
. It increments i
until it reaches j
. The implementation looks like:
Note that the macro behaves like a for
-loop. It can be used with a single statement or with a statement block. For bidirectional iterators or circulators, a backwards loop macro CGAL_For_all_backwards(i, j)
exists that decrements j
until it reaches i
.
CGAL::iterator_distance()
CGAL::is_empty_range()
CGAL::Circulator_tag
CGAL::Circulator_traits
CGAL::Assert_circulator_or_iterator
Circulator
#include <CGAL/circulator.h>
C::difference_type CGAL::circulator_distance | ( | C | c, |
C | d | ||
) |
The distance of a circulator c
to a circulator d
is the number of elements in the range [c, d)
.
It is defined to be zero for a circulator on an empty sequence and it returns the size of the data structure when applied to a range of the form [c, c)
.
#include <CGAL/circulator.h>
C::size_type CGAL::circulator_size | ( | C | c) |
The size of a circulator is the size of the data structure it refers to.
It is zero for a circulator on an empty sequence. The size can be computed in linear time for forward and bidirectional circulators, and in constant time for random access circulators using the minimal circulator. The function circulator_size(c)
returns the circulator size. It uses the c.min_circulator()
function if c
is a random access circulator.
#include <CGAL/circulator.h>
bool CGAL::is_empty_range | ( | const IC & | i, |
const IC & | j | ||
) |
is true
if the range [i, j)
is empty, false
otherwise.
In order to write algorithms that work with iterator ranges as well as with circulator ranges we have to consider the difference of representing an empty range. For iterators this is the range [i,i)
, while for circulators it would be c == NULL
, the empty sequence test. The function is_empty_range()
provides the necessary generic test which accepts an iterator range or a circulator range and says whether the range is empty or not.
IC
is either a circulator or an iterator type. The range [i, j)
is valid.Example
The following function process_all()
accepts a range [i, j)
of an iterator or circulator IC
and processes each element in this range:
iterator_distance
CGAL_For_all
Circulator_tag
Circulator_traits
Assert_circulator_or_iterator
Circulator
#include <CGAL/circulator.h>
iterator_traits<IC>::difference_type CGAL::iterator_distance | ( | IC | ic1, |
IC | ic2 | ||
) |
The following function returns the distance between either two iterators or two circulators.
circulator_size
circulator_distance
is_empty_range
Circulator_tag
Assert_circulator_or_iterator
CGAL_For_all
Circulator
#include <CGAL/circulator.h>
Iterator_tag CGAL::query_circulator_or_iterator | ( | const I & | i) |
This function matches for type I
if the iterator category of I
belongs to an iterator.
#include <CGAL/circulator.h>
Circulator_tag CGAL::query_circulator_or_iterator | ( | const C & | c) |
This functiona matches for type C
if the iterator category of C
belongs to a circulator.
#include <CGAL/circulator.h>