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} \section{Ranges}
Most data structures in \cgal\ use the concept of an iterator range. The 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 \ccc{Range} and \ccc{ConstRange} concepts encapsulate the access to the first
iterators of an iterator range. STL containers are models of \ccc{Range}. and the past-the-end iterators of an iterator range. STL containers are models
The Boost.Range library provides good support around this concept as well. 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. \ccc{std::iterator_traits} and the corresponding iterator type.
Boost also offers the Boost.Range 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. which provides good support for ranges.
Finally, let us note that ranges, in general (especially in template context) 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 \ccRefines
\ccc{ConstRange}
Boost's Range concept Boost's Range concept
%\ccCreation %\ccCreation
@ -33,26 +35,16 @@ Boost's Range concept
\ccTypes \ccTypes
\ccNestedType{const_iterator} {The constant iterator type.}
\ccGlue
\ccNestedType{iterator} {The iterator type. It must be convertible to \ccc{const_iterator}.} \ccNestedType{iterator} {The iterator type. It must be convertible to \ccc{const_iterator}.}
\ccHeading{Member functions} \ccHeading{Member functions}
\def\ccTagRmTrailingConst{\ccFalse} \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.} \ccMethod{iterator begin();}{returns the iterator pointing to the first element.}
\ccGlue \ccGlue
\ccMethod{iterator end();}{returns the past-the-end iterator.} \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} \def\ccTagRmTrailingConst{\ccTrue}
\ccHasModels \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 \cgal\ extends this in several directions. First, it supports the notion
of \ccc{Handle} (also sometimes refered to as the trivial iterator) which is 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 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 element. It also uses the \ccc{Range} and \ccc{ConstRange} concepts which
both the first and the past-the-end iterators of an iterator range. 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 Besides linear sequences, circular sequences also occur naturally in many combinatorial
and geometric structures. Examples are polyhedral surfaces and planar and geometric structures. Examples are polyhedral surfaces and planar
@ -35,6 +36,7 @@ circulators as well as with iterators.
\ccRefConceptPage{Handle}\\ \ccRefConceptPage{Handle}\\
\ccRefConceptPage{Range}\\ \ccRefConceptPage{Range}\\
\ccRefConceptPage{ConstRange}\\
\ccRefConceptPage{Circulator}\\ \ccRefConceptPage{Circulator}\\
\ccc{Forward_circulator}\\ \ccc{Forward_circulator}\\
\ccc{Bidirectional_circulator}\\ \ccc{Bidirectional_circulator}\\

View File

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