Introduce "base" concept ConstRange.

This commit is contained in:
Sylvain Pion 2010-08-19 12:37:28 +00:00
parent 5e267400c7
commit 01fa53b541
5 changed files with 50 additions and 16 deletions

View File

@ -1,6 +1,7 @@
\section{Ranges}
Most data structures in \cgal\ use the concept of an iterator range. The
\ccc{Range} concept encapsulates the access to the first and the past-the-end
iterators of an iterator range. STL containers are models of \ccc{Range}.
The Boost.Range library provides good support around this concept as well.
\ccc{Range} and \ccc{ConstRange} concepts encapsulate the access to the first
and the past-the-end iterators of an iterator range. STL containers are models
of \ccc{Range}. The Boost.Range library provides good support around this
concept as well.

View File

@ -0,0 +1,38 @@
\begin{ccRefConcept}{ConstRange}
\ccDefinition
A constant iterator range. Refer to the \ccc{Range} concept for more details.
\ccRefines
Boost's Range concept
\ccCreationVariable{r} %% choose variable name
\ccTypes
\ccNestedType{const_iterator} {The constant iterator type.}
\ccHeading{Member functions}
\def\ccTagRmTrailingConst{\ccFalse}
\ccMethod{const_iterator begin() const;}{returns the const iterator pointing to the first element.}
\ccGlue
\ccMethod{const_iterator end() const;}{returns the past-the-end const iterator.}
\ccMethod{difference_type size() const;}{returns the size of the range.}
\ccGlue
\ccMethod{bool empty() const;}{returns whether the range is empty.}
\def\ccTagRmTrailingConst{\ccTrue}
\ccHasModels
STL containers\\
\ccc{boost::iterator_range}
\ccSeeAlso
\ccc{Range}
\end{ccRefConcept}

View File

@ -17,7 +17,7 @@ bidirectional or random-access. The category can be queried using
\ccc{std::iterator_traits} and the corresponding iterator type.
Boost also offers the Boost.Range
library\footnote{\url{http://www.boost.org/doc/libs/1_43_0/libs/range/doc/html/index.html}}
library\footnote{\url{http://www.boost.org/doc/libs/1_44_0/libs/range/doc/html/index.html}}
which provides good support for ranges.
Finally, let us note that ranges, in general (especially in template context)
@ -26,6 +26,8 @@ difference with iterators which are typically passed by value.
\ccRefines
\ccc{ConstRange}
Boost's Range concept
%\ccCreation
@ -33,26 +35,16 @@ Boost's Range concept
\ccTypes
\ccNestedType{const_iterator} {The constant iterator type.}
\ccGlue
\ccNestedType{iterator} {The iterator type. It must be convertible to \ccc{const_iterator}.}
\ccHeading{Member functions}
\def\ccTagRmTrailingConst{\ccFalse}
\ccMethod{const_iterator begin() const;}{returns the const iterator pointing to the first element.}
\ccGlue
\ccMethod{const_iterator end() const;}{returns the past-the-end const iterator.}
\ccMethod{iterator begin();}{returns the iterator pointing to the first element.}
\ccGlue
\ccMethod{iterator end();}{returns the past-the-end iterator.}
\ccMethod{difference_type size() const;}{returns the size of the range.}
\ccGlue
\ccMethod{bool empty() const;}{returns whether the range is empty.}
\def\ccTagRmTrailingConst{\ccTrue}
\ccHasModels

View File

@ -15,8 +15,9 @@ The concept of iterators in the \stl\ is tailored for linear sequences.
\cgal\ extends this in several directions. First, it supports the notion
of \ccc{Handle} (also sometimes refered to as the trivial iterator) which is
used to document that no traversal operation is needed, only reference to an
element. It also uses the \ccc{Range} concept which encapsulates the access to
both the first and the past-the-end iterators of an iterator range.
element. It also uses the \ccc{Range} and \ccc{ConstRange} concepts which
encapsulates the access to both the first and the past-the-end iterators of an
iterator range.
Besides linear sequences, circular sequences also occur naturally in many combinatorial
and geometric structures. Examples are polyhedral surfaces and planar
@ -35,6 +36,7 @@ circulators as well as with iterators.
\ccRefConceptPage{Handle}\\
\ccRefConceptPage{Range}\\
\ccRefConceptPage{ConstRange}\\
\ccRefConceptPage{Circulator}\\
\ccc{Forward_circulator}\\
\ccc{Bidirectional_circulator}\\

View File

@ -18,6 +18,7 @@
\input{Circulator_ref/Container_from_circulator.tex}
\input{Circulator_ref/For_all.tex}
\input{Circulator_ref/Handle.tex}
\input{Circulator_ref/ConstRange.tex}
\input{Circulator_ref/Range.tex}
\input{Circulator_ref/is_empty_range.tex}
\input{Circulator_ref/iterator_distance.tex}