diff --git a/doc/boost_range.html b/doc/boost_range.html index e652436..d8d956d 100644 --- a/doc/boost_range.html +++ b/doc/boost_range.html @@ -94,14 +94,6 @@ class=identifier>range_difference; struct range_reverse_iterator; - - // - // Random Access Range metafunctions - // - - template< class T > - struct range_size; // // Single Pass Range functions @@ -112,7 +104,7 @@ class=identifier>range_size; begin( T& c ); template< class T > - typename range_iterator<T>::type + typename range_iterator<const T>::type begin( const T& c ); template< class T > @@ -120,7 +112,7 @@ class=identifier>range_size; end( T& c ); template< class T > - typename range_iterator<T>::type + typename range_iterator<const T>::type end( const T& c ); template< class T > @@ -144,7 +136,7 @@ class=identifier>range_size; rbegin( T& c ); template< class T > - typename range_reverse_iterator<T>::type + typename range_reverse_iterator<const T>::type rbegin( const T& c ); template< class T > @@ -152,11 +144,10 @@ class=identifier>range_size; rend( T& c ); template< class T > - typename range_reverse_iterator<T>::type + typename range_reverse_iterator<const T>::type rend( const T& c ); - // // Random Access Range functions // @@ -164,7 +155,7 @@ class=identifier>T& template< class T > typename range_size<T>::type size( const T& c ); - + // // Special const Range functions // @@ -247,10 +238,8 @@ class=identifier>T& range_value<X>::type - T::value_type
- boost::iterator_value<P::first_type>::type
- A
- Char + boost::iterator_value<range_iterator<X>::type>::type + compile time @@ -264,7 +253,7 @@ class=identifier>T
& - range_const_iterator<X>::type + range_iterator<const X>::type T::const_iterator
P::first_type
const A*
@@ -274,20 +263,11 @@ class=identifier>T
& range_difference<X>::type - T::difference_type
- boost::iterator_difference<P::first_type>::type
- std::ptrdiff_t
- std::ptrdiff_t
+ + boost::iterator_difference<range_iterator<X>::type>::type + compile time - - - range_size<X>::type - T::size_type
- std::size_t
- std::size_t
- std::size_t
- compile time @@ -301,31 +281,18 @@ class=identifier>T
& range_reverse_iterator<X>::type - boost::reverse_iterator< typename range_iterator<T>::type >
+ boost::reverse_iterator<range_iterator<X>::type>
compile time - range_const_reverse_iterator<X>::type - boost::reverse_iterator< typename range_const_iterator<T>::type > + range_reverse_iterator<const X>::type + boost::reverse_iterator<range_iterator<const X>::type>
compile time - - - range_reverse_result_iterator<X>::type - boost::reverse_iterator< typename range_result_iterator<T>::type - > - compile time -

-

- The special metafunctions range_result_iterator and range_reverse_result_iterator - are not part of any Range concept, but they are very useful when implementing - certain Range classes like sub_range - because of their ability to select iterators based on constness. -

Functions

@@ -347,7 +314,7 @@ class=identifier>T& p.first if p is of type std::pair<T>
a if a is an array
s if s is a string literal
- boost_range_begin(x) if that expression would invoke a function found by ADL
+ range_begin(x) if that expression would invoke a function found by ADL
t.begin() otherwise
@@ -363,7 +330,7 @@ class=identifier>T& s + sz - 1 if s is a string literal of size sz
- boost_range_end(x) if that expression would invoke a function found by ADL
+ range_end(x) if that expression would invoke a function found by ADL
t.end() otherwise
+ + + + + + + + + - - + + - - + @@ -408,15 +380,15 @@ class=identifier>T& - - + - - + @@ -424,15 +396,15 @@ class=identifier>T& - - + - - + @@ -440,21 +412,22 @@ class=identifier>T& - - +
constant timelinear if X is Char* @@ -380,27 +347,32 @@ class=identifier>T&
distance(x)range_difference<X>::type + + std::distance(boost::begin(x),boost::end(x)) + + -
size(x)range_size<X>::type - std::distance(p.first,p.second) if p is of type std::pair<T>
- sz if a is an array of size sz
- end(s) - s if s is a string literal or a Char*
- boost_range_size(x) if that expression would invoke a function found by ADL
- t.size() otherwise -
linear if X is Char* -
- or if std::distance() is linear -
- constant time otherwise
range_difference<X>::type boost::end(x) - boost::begin(x) + + constant time
rbegin(x)range_reverse_result_iterator<X>::typerange_reverse_result_iterator<X>::type( end(x) ) + range_reverse_iterator<X>::typerange_reverse_iterator<X>::type( end(x) )
same as end(x) rend(x)range_reverse_result_iterator<X>::typerange_reverse_result_iterator<X>::type( begin(x) ) + range_reverse_iterator<X>::typerange_reverse_iterator<X>::type( begin(x) ) same as begin(x)
const_begin(x)range_const_iterator<X>::typerange_const_iterator<X>::type( begin(x) ) + range_iterator<const X>::typerange_iterator<const X>::type( begin(x) )
same as begin(x) const_end(x)range_const_iterator<X>::typerange_const_iterator<X>::type( end(x) ) + range_iterator<const X>::typerange_iterator<const X>::type( end(x) ) same as end(x)
const_rbegin(x)range_const_reverse_iterator<X>::typerange_const_reverse_iterator<X>::type( rbegin(x) ) + range_reverse_iterator<const X>::typerange_reverse_iterator<const X>::type( rbegin(x) )
same as rbegin(x) const_rend(x)range_const_reverse_iterator<X>::typerange_const_reverse_iterator<X>::type( rend(x) ) + range_reverse_iterator<const X>::typerange_reverse_iterator<const X>::type( rend(x) ) same as rend(x)

- The special const functions are not part of any Range concept, but - are very useful when you want to document clearly that your code is read-only. + The special const_-named functions are useful when you + want to document clearly that your code is read-only.


Extending the library

@@ -491,10 +464,6 @@ class=identifier>T
& Single Pass Range - - size() - Forward Range -

@@ -520,10 +489,6 @@ class=identifier>T& const_iterator Single Pass Range - - size_type - Forward Range -

@@ -554,26 +519,23 @@ class=identifier>T& Related concept - boost_range_begin(x) + range_begin(x) Single Pass Range - boost_range_end(x) + range_end(x) Single Pass Range - - boost_range_size(x) - Forward Range - +

-

boost_range_begin() and boost_range_end() must be +

range_begin() and range_end() must be overloaded for both const and mutable reference arguments.

- You must also specialize 3 metafunctions for your type X: + You must also specialize two metafunctions for your type X:

@@ -583,17 +545,14 @@ class=identifier>T& Related concept - + - - - - +
boost::range_iteratorboost::range_mutable_iterator Single Pass Range
boost::range_const_iterator Single Pass Range
boost::range_sizeForward Range

@@ -627,7 +586,7 @@ class=identifier>T& template< class T > - struct range_iterator< Foo::Pair<T> > + struct range_mutable_iterator< Foo::Pair<T> > { typedef T type; }; @@ -636,20 +595,13 @@ class=identifier>T& struct range_const_iterator< Foo::Pair<T> > { // - // Remark: this is defined similar to 'range_iterator' + // Remark: this is defined similar to 'range_mutable_iterator' // because the 'Pair' type does not distinguish // between an iterator and a const_iterator. // typedef T type; }; - template< class T > - struct range_size< Foo::Pair<T> > - { - - typedef std::size_t type; - }; - } // namespace 'boost' namespace Foo @@ -661,36 +613,29 @@ class=identifier>T& template< class T > - inline T boost_range_begin( Pair<T>& x ) + inline T range_begin( Pair<T>& x ) { return x.first; } template< class T > - inline T boost_range_begin( const Pair<T>& x ) + inline T range_begin( const Pair<T>& x ) { return x.first; } template< class T > - inline T boost_range_end( Pair<T>& x ) + inline T range_end( Pair<T>& x ) { return x.last; } template< class T > - inline T boost_range_end( const Pair<T>& x ) + inline T range_end( const Pair<T>& x ) { return x.last; } - template< class T > - inline typename boost::range_size< Pair<T> >::type - boost_range_size( const Pair<T>& x ) - { - return std::distance(x.first,x.last); - } - } // namespace 'Foo' #include <vector> @@ -699,7 +644,7 @@ class=identifier>T& { typedef std::vector<int>::iterator iter; std::vector<int> vec; - Foo::Pair<iter> pair = { vec.begin(), vec.end() }; + Foo::Pair<iter> pair = { vec.begin(), vec.end() }; const Foo::Pair<iter>& cpair = pair; // // Notice that we call 'begin' etc with qualification. @@ -708,9 +653,9 @@ class=identifier>T& iter e = boost::end( pair ); i = boost::begin( cpair ); e = boost::end( cpair ); - boost::range_size< Foo::Pair<iter> >::type s = boost::size( pair ); + boost::range_difference< Foo::Pair<iter> >::type s = boost::size( pair ); s = boost::size( cpair ); - boost::range_const_reverse_iterator< Foo::Pair<iter> >::type + boost::range_reverse_iterator< const Foo::Pair<iter> >::type ri = boost::rbegin( cpair ), re = boost::rend( cpair ); } @@ -719,7 +664,7 @@ class=identifier>T&

- (C) Copyright Thorsten Ottosen 2003-2004 + (C) Copyright Thorsten Ottosen 2003-2007



diff --git a/doc/examples.html b/doc/examples.html index 6db7253..0ea235d 100755 --- a/doc/examples.html +++ b/doc/examples.html @@ -26,10 +26,6 @@ shows how to implement a container version of std::find() that works with char[],wchar_t[],char*,wchar_t*. -

- Warning: support for null-terminated strings is deprecated and will - disappear in the next Boost release (1.34). -

  • algorithm_example.cpp diff --git a/doc/intro.html b/doc/intro.html index b0542b2..8478d3e 100755 --- a/doc/intro.html +++ b/doc/intro.html @@ -35,16 +35,14 @@ enough functionality to satisfy the needs of the generic code if a suitable layer of indirection is applied . For example, raw arrays are often suitable for use with generic code that - works with containers, provided a suitable adapter is used. Likewise, null - terminated strings can be treated as containers of characters, if suitably - adapted. + works with containers, provided a suitable adapter is used.

    This library therefore provides the means to adapt standard-like - containers, - null terminated strings, std::pairs of iterators, and raw - arrays (and more), such that the same generic code can work with them all. + containers, std::pairs of iterators, and raw arrays (and + more), such that + the same generic code can work with them all. The basic idea is to add another layer of indirection using metafunctions and free-standing functions so syntactic and/or semantic differences can be removed. diff --git a/doc/mfc_atl.html b/doc/mfc_atl.html index 5717cc8..a022fe3 100644 --- a/doc/mfc_atl.html +++ b/doc/mfc_atl.html @@ -3,14 +3,289 @@ - + Boost Range MFC/ATL Extension @@ -33,7 +308,7 @@

    Overview

    -

    Boost.Range MFC/ATL Extension provides Boost.Range support for MFC/ATL collection and string types.

    +

    Boost.Range MFC/ATL Extension provides Boost.Range support for MFC/ATL collection and string types.

     CTypedPtrArray<CPtrArray, CList<CString> *> myArray;
     ...
    @@ -64,7 +339,7 @@ BOOST_FOREACH (CList<CString> *theList, myArray)
     

    MFC Ranges

    -

    If the <boost/range/mfc.hpp> is included before or after Boost.Range headers, +

    If the <boost/range/mfc.hpp> is included before or after Boost.Range headers, the MFC collections and strings become models of Range. The table below lists the Traversal Category and range_reference of MFC ranges.

    @@ -170,7 +445,7 @@ The table below lists the Traversal Category and
    -

    Other Boost.Range metafunctions are defined by the following. +

    Other Boost.Range metafunctions are defined by the following. Let Range be any type listed above and ReF be the same as range_reference<Range>::type. range_value<Range>::type is the same as remove_reference<remove_const<Ref>::type>::type, range_difference<Range>::type is the same as std::ptrdiff_t, and @@ -179,7 +454,7 @@ As for const

    ATL Ranges

    -

    If the <boost/range/atl.hpp> is included before or after Boost.Range headers, +

    If the <boost/range/atl.hpp> is included before or after Boost.Range headers, the ATL collections and strings become models of Range. The table below lists the Traversal Category and range_reference of ATL ranges.

    @@ -265,7 +540,7 @@ The table below lists the Traversal Category and
    -

    Other Boost.Range metafunctions are defined by the following. +

    Other Boost.Range metafunctions are defined by the following. Let Range be any type listed above and ReF be the same as range_reference<Range>::type. range_value<Range>::type is the same as remove_reference<Ref>::type, range_difference<Range>::type is the same as std::ptrdiff_t, and @@ -288,7 +563,7 @@ else if (there is a type X such that X* const is the same as ReF) else return ReF -

    Other Boost.Range metafunctions are defined by the following. +

    Other Boost.Range metafunctions are defined by the following. range_value<const Range>::type is the same as range_value<Range>::type, range_difference<const Range>::type is the same as std::ptrdiff_t, and range_pointer<const Range>::type is the same as add_pointer<remove_reference<range_reference<const Range>::type>::type>::type.

    @@ -296,18 +571,11 @@ else -
    - diff --git a/doc/mfc_atl.rst b/doc/mfc_atl.rst index 3dcd8fe..67498fb 100644 --- a/doc/mfc_atl.rst +++ b/doc/mfc_atl.rst @@ -225,8 +225,8 @@ __ http://msdn2.microsoft.com/en-US/library/15e672bd.aspx .. _Boost C++ Libraries: http://www.boost.org/ .. _Boost: `Boost C++ Libraries`_ -.. _Boost.Range: http://www.boost.org/libs/range/ -.. _forward: http://www.boost.org/libs/range/doc/range.html#forward_range -.. _bidirectional: http://www.boost.org/libs/range/doc/range.html#forward_range -.. _random access: http://www.boost.org/libs/range/doc/range.html#random_access_range +.. _Boost.Range: ../index.html +.. _forward: range.html#forward_range +.. _bidirectional: range.html#forward_range +.. _random access: range.html#random_access_range diff --git a/doc/portability.html b/doc/portability.html index ae3a264..20b1355 100755 --- a/doc/portability.html +++ b/doc/portability.html @@ -36,7 +36,7 @@ href="http://boost.sourceforge.net/regression-logs/developer/range.html">here Notice also that some compilers cannot do function template ordering properly. In that case one must rely of range_result_iterator + href="boost_range.html#range_iterator">range_iterator and a single function definition instead of overloaded versions for const and non-const arguments. diff --git a/doc/range.html b/doc/range.html index 03a773d..dfe9345 100755 --- a/doc/range.html +++ b/doc/range.html @@ -50,7 +50,7 @@ Range provides iterators for accessing a half-open range [first,one_past_last) of elements and provides information about the number of elements in the Range. However, a Range has - fewer requirements than a Container. + much fewer requirements than a Container.

    The motivation for the Range concept is @@ -78,9 +78,9 @@ The operations that can be performed on a Range is dependent on the traversal category of the underlying iterator type. Therefore - the range concepts are named to reflect which traversal category its - iterators support. See also terminology and style guidelines. - for more information about naming of ranges.

    + the range concepts are named to reflect which traversal category their + iterators support. See also terminology and style + guidelines. for more information about naming of ranges.

    The concepts described below specifies associated types as metafunctions and all @@ -118,11 +118,7 @@ Single Pass Iterator

    Associated types

    - - - - + @@ -132,7 +128,7 @@ Single Pass Iterator - + @@ -161,20 +157,16 @@ Single Pass Iterator - - - - - +
    Value typeboost::range_value<X>::typeThe type of the object stored in a Range. -
    Iterator type boost::range_iterator<X>::type
    Const iterator typeboost::range_const_iterator<X>::typeboost::range_iterator<const X>::type A type of iterator that may be used to examine, but not to modify, a Range's elements.
    Beginning of range boost::begin(a) boost::range_iterator<X>::type if -a is mutable, boost::range_const_iterator<X>::type +a is mutable, boost::range_iterator<const X>::type otherwise
    End of range boost::end(a) boost::range_iterator<X>::type if -a is mutable, boost::range_const_iterator<X>::type +a is mutable, boost::range_iterator<const X>::type otherwise
    Is range empty?boost::empty(a)Convertible to bool

    Expression semantics

    @@ -188,7 +180,7 @@ otherwise boost::begin(a) Returns an iterator pointing to the first element in the Range. boost::begin(a) is either dereferenceable or past-the-end. - It is past-the-end if and only if boost::size(a) == 0. + It is past-the-end if and only if boost::distance(a) == 0. boost::end(a) @@ -196,19 +188,14 @@ otherwise Range. boost::end(a) is past-the-end. - - boost::empty(a) - Equivalent to boost::begin(a) == boost::end(a). (But possibly - faster.) -  -  - +

    Complexity guarantees

    - All three functions are at most amortized linear time. For most practical - purposes, one can expect boost::begin(a), boost::end(a) and boost::empty(a) - to be amortized constant time. + boost::end(a) is at most amortized linear time, boost::begin(a) is + amortized constant time. For most practical + purposes, one can expect both to be amortized constant time.

    Invariants

    @@ -227,14 +214,17 @@ otherwise

    See also

    -

    - Container -

    -

    implementation of +

    Extending the library for UDTs

    +

    Implementation of metafunctions

    -

    implementation of +

    Implementation of functions

    +

    + Container +

    +

    Forward Range

    @@ -261,76 +251,8 @@ href="../../iterator/doc/new-iter-concepts.html#forward-traversal-iterators-lib-

    Refinement of

    Single Pass Range -

    Associated types

    - -
    - - - - - - - - - - -
    Distance typeboost::range_difference<X>::typeA signed integral type used to represent the distance between - two of the Range's iterators. This type must be the same as the iterator's - distance type.
    Size typeboost::range_size<X>::typeAn unsigned integral type that can represent any nonnegative - value of the Range's distance type.
    - -

    Valid expressions

    - - - - - - - - - - - - -
    NameExpressionReturn type
    Size of rangeboost::size(a)boost::range_size<X>::type
    - -

    Expression semantics

    - - - - - - - - - - - - -
    ExpressionSemanticsPostcondition
    boost::size(a)Returns the size of the Range, that is, its number -of elements. Note boost::size(a) == 0u is equivalent to -boost::empty(a).boost::size(a) >= 0
    - -

    Complexity guarantees

    - -

    boost::size(a) is at most amortized linear time.

    - -

    Invariants

    -

    - - - -
    Range sizeboost::size(a) is equal to the distance from boost::begin(a) - to boost::end(a).
    -

    - -

    See also

    -

    implementation of - metafunctions

    - -

    implementation of - functions

    - +

    +

    Bidirectional Range

    @@ -356,83 +278,8 @@ s-lib-bidirectional-traversal-iterators">Bidirectional Traversal Iterator.

    Refinement of

    Forward Range -

    Associated types

    - - - - - - - - - - - - -
    Reverse Iterator typeboost::range_reverse_iterator<X>::typeThe type of iterator used to iterate through a Range's elements - in reverse order. The iterator's value type is expected to be the Range's value - type. A conversion from the reverse iterator type to the const reverse iterator - type must exist.
    Const reverse iterator typeboost::range_const_reverse_iterator<X>::typeA type of reverse iterator that may be used to examine, but not - to modify, a Range's elements.
    - - -

    Valid expressions

    - - - - - - - - - - - - - - - - - - - -
    NameExpressionReturn typeSemantics
    Beginning of rangeboost::rbegin(a)boost::range_reverse_iterator<X>::type if -a is mutable, boost::range_const_reverse_iterator<X>::type -otherwise.Equivalent to -boost::range_reverse_iterator<X>::type(boost::end(a)).
    End of rangeboost::rend(a)boost::range_reverse_iterator<X>::type if -a is mutable, boost::range_const_reverse_iterator<X>::type -otherwise.Equivalent to -boost::range_reverse_iterator<X>::type(boost::begin(a)).
    - -

    Complexity guarantees

    - - boost::rbegin(a) has the same complexity as boost::end(a) and boost::rend(a) - has the same complexity as boost::begin(a) from Forward Range. - -

    Invariants

    -

    - - - - - - - - - -
    Valid reverse rangeFor any Bidirectional Range a, [boost::rbegin(a),boost::rend(a)) - is a valid range, that is, boost::rend(a) is reachable from boost::rbegin(a) - in a finite number of increments.
    CompletenessAn algorithm that iterates through the range [boost::rbegin(a),boost::rend(a)) - will pass through every element of a.
    -

    - -

    See also

    -

    implementation of metafunctions

    - -

    implementation of - functions

    + +


    @@ -455,7 +302,7 @@ href="../../iterator/doc/new-iter-concepts.html#random-access-traversal-iterator

    Concept Checking

    Each of the range concepts has a corresponding concept checking - class in the file boost/range/concepts.hpp. These classes may be + class in the file . These classes may be used in conjunction with the
    Boost Concept Check library to insure that the type of a template parameter @@ -529,7 +376,7 @@ href="../../iterator/doc/new-iter-concepts.html#random-access-traversal-iterator Jeremy Siek - Copyright © 2004 + Copyright © 2004-2007 Thorsten Ottosen. diff --git a/doc/utility_class.html b/doc/utility_class.html index 57bf5dc..16df096 100644 --- a/doc/utility_class.html +++ b/doc/utility_class.html @@ -59,19 +59,16 @@ corresponding const_iterator is.

    If the template argument is not a model of Forward Traversal Iterator, one can still use a subset of the interface. In particular, size() requires - Forward Traversal Iterators whereas empty() only requires Single + Random Access Iterators whereas empty() only requires Single Pass Iterators.

    Recall that many default constructed iterators are singular and hence can only be assigned, but not compared or - incremented or anything. However, if one creates a default constructed - iterator_range, then one - can still call all its member functions. This means that the - iterator_range will still be usable in many contexts even - though the iterators underneath are not. -

    + incremented or anything. Likewise, if one creates a default constructed + iterator_range, then one have to be careful about not doing + anything besides copying.

    Synopsis

    @@ -82,9 +79,6 @@ corresponding const_iterator is.

    class iterator_range { public: // Forward Range types - typedef ... value_type; - typedef ... difference_type; - typedef ... size_type; typedef ForwardTraversalIterator iterator; typedef ForwardTraversalIterator const_iterator; @@ -117,10 +111,11 @@ class=identifier>equal( const iterator_range& ) const; - value_type& front() const; - value_type& back() const; + referencefront() const; + reference back() const; // for Random Access Range only: value_type& operator[]( size_type at ) const; + value_typecial>& operator()( size_type at ) const; }; // stream output