Navigation: Up, Table of Contents, Bibliography, Index, Title Page

## CGAL::is_empty_range

### Definition

In order to write algorithms that work with iterator ranges as well as with circulator ranges we have to consider the difference of representing an empty range. For iterators this is the range [i,i), while for circulators it would be c == NULL, the empty sequence test. The function is_empty_range provides the necessary generic test which accepts an iterator range or a circulator range and says whether the range is empty or not.

#include <CGAL/circulator.h>

template< class IC>
bool | is_empty_range ( IC i, IC j)
|  | is true if the range [i, j) is empty, false otherwise. Precondition: IC is either a circulator or an iterator type. The range [i, j) is valid.

### Example

The following function process_all accepts a range [i, j) of an iterator or circulator IC and processes each element in this range:

    template <class IC>
    void process_all( IC i, IC j) {
        if (! CGAL::is_empty_range( i, j)) {
            do {
                process(*i);
            } while (++i != j);
        }
    }

### See Also

iterator_distance, CGAL_For_all, Circulator_tag, Circulator_traits,
Assert_circulator_or_iterator, Circulator.

Next: iterator_distance

Navigation: Table of Contents, Bibliography, Index, Title Page

The CGAL Project . Tue, December 21, 2004 .