CGAL 5.0.3 - Handles and Circulators
|
#include <CGAL/circulator.h>
The adaptor Circulator_from_iterator
converts two iterators of type I
, a begin and a past-the-end value, to a circulator of equal category.
The iterator must be at least of the forward iterator category. The circulator will be mutable or non-mutable according to the iterator. Iterators provide no size_type
. This adapter assumes std::size_t
instead.
Operations
The adaptor conforms to the requirements of the respective 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 an iterator to a circulator and back to an iterator. It applies an STL sort algorithm on a STL vector containing 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_prog1.cpp
Another example usage for this adaptor is a random access circulator over the built-in C arrays. Given an array of type T*
with a begin pointer b
and a past-the-end pointer e
the adaptor Circulator_from_iterator<T*> c(b,e)
is a random access circulator c
over this array.
Types | |
In addition all types required for circulators are provided. | |
typedef I | iterator |
Creation | |
Circulator_from_iterator () | |
a circulator c on an empty sequence. | |
Circulator_from_iterator (const I &begin, const I &end, const I &cur=begin) | |
a circulator c initialized to refer to the element *cur in a range [begin, end) . More... | |
Circulator_from_iterator (const Circulator_from_iterator< I, T, Size, Dist > &d, const I &cur) | |
a copy of circulator d referring to the element *cur . More... | |
CGAL::Circulator_from_iterator< I >::Circulator_from_iterator | ( | const I & | begin, |
const I & | end, | ||
const I & | cur = begin |
||
) |
a circulator c
initialized to refer to the element *cur
in a range [begin, end)
.
The circulator c
refers to a empty sequence if begin==end
.
CGAL::Circulator_from_iterator< I >::Circulator_from_iterator | ( | const Circulator_from_iterator< I, T, Size, Dist > & | d, |
const I & | cur | ||
) |
a copy of circulator d
referring to the element *cur
.
The circulator c
refers to a empty sequence if d
does so.