C is the container type. The container 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 value_type, size_type(), and difference_type).
#include <CGAL/circulator.h>
|
| |
|
the template argument C.
| |
|
| |
|
a circulator c with a singular value.
| |
|
| |
|
a circulator c initialized to refer to the first element in
container, i.e. container.begin(). The circulator
c contains a singular value if the container is
empty.
| |
|
| |
|
a circulator c initialized to refer to the element *i
in container. Precondition: *i is dereferenceable and refers to container.
| |
|
| |||
|
a const circulator c with a singular value.
| |||
|
| |||
|
a const circulator c initialized to refer to the first
element in container, i.e. container.begin(). The
circulator c contains a singular value if the
container is empty.
| |||
| |||
|
a const circulator c initialized to refer to the element
*i in container. Precondition: *i is dereferenceable and refers to the container.
| |||
The bidirectional and random access circulators have similar constructors. The default construction is shown here to present the adaptor names.
|
|
|
|
|
|
|
|
/* circulator_prog2.C */
/* ------------------------------ */
#include <CGAL/basic.h>
#include <assert.h>
#include <vector.h>
#include <algo.h>
#include <CGAL/circulator.h>
typedef CGAL_Random_access_circulator_from_container< vector<int> > Circulator;
typedef CGAL_Random_access_container_from_circulator<Circulator> Container;
typedef Container::iterator Iterator;
main() {
vector<int> v;
v.push_back(5);
v.push_back(2);
v.push_back(9);
Circulator c( &v);
Container container( c);
sort( container.begin(), container.end());
Iterator i = container.begin();
assert( *i == 2);
i++; assert( *i == 5);
i++; assert( *i == 9);
i++; assert( i == container.end());
return 0;
}