CGAL 5.1 - STL Extensions for CGAL
|
#include <CGAL/iterator.h>
The class Inverse_index
constructs an inverse index for a given range [i,j)
of two iterators or circulators of type IC
. The first element I
in the range [i,j)
has the index 0. Consecutive elements are numbered incrementally. The inverse index provides a query for a given iterator or circulator k
to retrieve its index number.
Implementation
For random access iterators or circulators, it is done in constant time by subtracting i
. For other iterator categories, an STL map
is used, which results in a log(j-i)
query time. The comparisons are done using the operator operator<
on pointers.
CGAL::Random_access_adaptor<IC>
CGAL::Random_access_value_adaptor<IC,T>
Creation | |
Inverse_index () | |
invalid index. More... | |
Inverse_index (const IC &i) | |
empty inverse index initialized to start at i . More... | |
Inverse_index (const IC &i, const IC &j) | |
inverse index initialized with range [i,j) . More... | |
Operations | |
std::size_t | operator[] (const IC &k) |
returns inverse index of k . More... | |
void | push_back (const IC &k) |
adds k at the end of the indices. More... | |
CGAL::Inverse_index< IC >::Inverse_index | ( | ) |
invalid index.
CGAL::Inverse_index< IC >::Inverse_index | ( | const IC & | i | ) |
empty inverse index initialized to start at i
.
CGAL::Inverse_index< IC >::Inverse_index | ( | const IC & | i, |
const IC & | j | ||
) |
inverse index initialized with range [i,j)
.
std::size_t CGAL::Inverse_index< IC >::operator[] | ( | const IC & | k | ) |
returns inverse index of k
.
k
has been stored in the inverse index. void CGAL::Inverse_index< IC >::push_back | ( | const IC & | k | ) |
adds k
at the end of the indices.