CGAL 5.6.3 - Handles and Circulators

Loading...
Searching...
No Matches
List of all members
Range Concept Reference
Handles and Circulators Reference » Concepts

## Definition

CGAL and the STL heavily use the concepts of iterators and iterator ranges to describe linear sequences of elements, and algorithms operating on these.

The `Range` concept aims at encapsulating an iterator range, by providing access to the first and past-the-end iterators of a range. The advantage is that the syntax for passing ranges is much more concise than passing two arguments separately.

Ranges come in different categories depending on the category of their iterator : mutable or constant (modifiability of the elements pointed to), and forward, bidirectional or random-access. The category can be queried using `std::iterator_traits` and the corresponding iterator type. Note that the concepts `Range` and `ConstRange` do not require anything on the category or the value type of the iterator. It must be precised in the documentation of any model of these concepts. For example, in the case of a vector of points, one would say: This type is a model of `Range` concept, its iterator type is random-access and its value type is `Point`.

Boost also offers the Boost.Range library which provides good support for ranges.

Finally, let us note that ranges, in general (especially in template context) need to be passed and returned by (const) reference for efficiency. This is a difference with iterators which are typically passed by value.

Refines
  `ConstRange`
  Boost's Range concept

Has Models:
  STL containers

## Types
typedef unspecified_type | const_iterator
| The constant iterator type.
typedef unspecified_type | iterator
| The iterator type.
typedef unspecified_type | size_type
| An unsigned integral type that can represent the size of a range.

## Member functions
const_iterator | begin () const
| returns the const iterator pointing to the first element.
const_iterator | end () const
| returns the past-the-end const iterator.
iterator | begin ()
| returns the iterator pointing to the first element.
iterator | end ()
| returns the past-the-end iterator.
size_type | size () const
| returns the size of the range.
bool | empty () const
| returns whether the range is empty.

## Member Typedef Documentation

## ◆ iterator

typedef unspecified_type Range::iterator

The iterator type.

It must be convertible to `const_iterator`.