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>
CGAL_Forward_circulator_from_container<C>::Container | |
the template argument C.
|
CGAL_Forward_circulator_from_container<C> c; | |||
a circulator c with a singular value.
| |||
CGAL_Forward_circulator_from_container<C> c ( C* container); | |||
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.
|
CGAL_Forward_const_circulator_from_container<C> c; | |||
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.
CGAL_Bidirectional_circulator_from_container<C> c; |
CGAL_Bidirectional_const_circulator_from_container<C> c; |
CGAL_Random_access_circulator_from_container<C> c; |
CGAL_Random_access_const_circulator_from_container<C> c; |
/* circulator_prog2.C */ /* ------------------------------ */ #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; }