CGAL 6.0.1 - Handles and Circulators
|
#include <CGAL/circulator.h>
The adaptor Circulator_from_container
provides a circulator for an STL container C
of equal category as the iterator provided by the container.
The iterator must be at least of the forward iterator category. The corresponding non-mutable circulator is called Const_circulator_from_container<C>
.
The container type C
is supposed to conform to the STL requirements for container (i.e. to have a begin()
and an end()
iterator as well as the local types reference
, const_reference
, value_type
, size_type
, and difference_type
).
Types
All types required for circulators are provided.
Operations
The adaptor conforms to the requirements of the corresponding circulator category. An additional member function current_iterator()
returns the current iterator pointing to the same position as the circulator does.
Example
The following program composes two adaptors - from a container to a circulator and back to an iterator. It applies an STL sort algorithm on a STL vector with three elements. The resulting vector will be [2 5 9]
as it is checked by the assertions. The program is part of the CGAL distribution.
File Circulator/circulator_prog2.cpp
Creation | |
Circulator_from_container () | |
a circulator c on an empty sequence. | |
Circulator_from_container (C *container) | |
a circulator c initialized to refer to the first element in container , i.e. container.begin() . | |
Circulator_from_container (C *container, C::iterator i) | |
a circulator c initialized to refer to the element *i in container . | |
CGAL::Circulator_from_container< C >::Circulator_from_container | ( | C * | container | ) |
a circulator c
initialized to refer to the first element in container
, i.e. container.begin()
.
The circulator c
refers to an empty sequence if the container
is empty.
CGAL::Circulator_from_container< C >::Circulator_from_container | ( | C * | container, |
C::iterator | i | ||
) |
a circulator c
initialized to refer to the element *i
in container
.
*i
is dereferenceable and refers to container
.