From e245cc6a7e8c9444999a0b6934be8c990c5acd45 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thorsten=20J=C3=B8rgen=20Ottosen?= Date: Tue, 10 Aug 2004 11:53:33 +0000 Subject: [PATCH] *** empty log message *** [SVN r24371] --- doc/boost_range.html | 630 ++++++++++++++++++++++--------------------- doc/examples.html | 64 +++++ index.html | 11 +- 3 files changed, 395 insertions(+), 310 deletions(-) create mode 100755 doc/examples.html diff --git a/doc/boost_range.html b/doc/boost_range.html index ec65bdc..0d9c8f0 100644 --- a/doc/boost_range.html +++ b/doc/boost_range.html @@ -6,353 +6,379 @@ - + + + + + + +


+ Boost.Range

+

Single Pass Range, Forward Range and Bidirectional Range Implementation

- - - - - -


- Boost.Range

+ +
-

Range and ReversibleRange Implementation

+

Overview

+

+ Four types of objects are currently supported by the library: +

+ + Even though the behavior of the primary templates are exactly such + that standard containers will be supported by default, the requirements + are much lower than the standard container requirements. For example, + the utility class iterator_range implements the minimal interface required to make the class + a Forward Range. +

+ +

+ Please also see Range concepts for more details. +

+ + +

Synopsis

- -
+

-

Overview

-

-Five types of objects are currently supported by the library: -

-It is worth noticing that some functionality requires partial template -specialization, in particular, full array support does (remark: this is a very -small problem since one would use boost::array<> anyway). Also note -that arrays and pointers of char or whar_t are -treated special because of their use in string algorithms. -

- -

-The concept is defined by the metafunction and the functions below. Even -though these functions are defined in namespace boost, there is no -such general requirement, that is, if one wants to extend the list of supported -types, it can be done in any namespace. -

- -

Synopsis

- -

- -

+    
 namespace boost
 {
     //
-    // Range metafunctions
+    // Single Pass Range metafunctions
     //
     
     template< class T >
-    struct value_type_of
-    {
-        typedef ... type; // type of stored objTts
-    };
+    struct value_type_of;
                  
     template< class T >
-    struct iterator_of
-    {
-        typedef ... type; // iterator over stored objects
-    };
+    struct iterator_of;
     
     template< class T >
-    struct const_iterator_of
-    {
-        typedef ... type; // iterator over immutable stored objects
-    };
+    struct const_iterator_of;
+    
+    //
+    // Forward Range metafunctions
+    //
     
     template< class T >
-    struct difference_type_of
-    {
-        typedef ... type;
-        BOOST_STATIC_ASSERT( boost::is_signed< type >::value );
-        //
-        // remark: if std::iterator_traits<> works for the type, this assertion must
-        hold
-        //
-        BOOST_STATIC_ASSERT( boost::is_same< type, std::iterator_traits< typename
-                                                   iterator_of< T >::type >::difference_type>::value );
-    };
+    struct difference_type_of;
     
     template< class T >
-    struct size_type_of
-    {
-        typedef ... type;
-        BOOST_STATIC_ASSERT( boost::is_unsigned< type >::value );
-        BOOST_STATIC_ASSERT( sizeof( type ) >= sizeof( 
-        difference_type_of< T >::type ) );
-    };
+    struct size_type_of;
+    
+    //
+    // Bidirectional Range metafunctions
+    //
     
     template< class T >
-    struct result_iterator_of
-    {
-        typedef ... type;
-        // iterator_of< T >::type if T is non-const, 
-        const_iterator_of< T >::type otherwise
-    };
+    struct reverse_iterator_of;
+
+    template< class T >
+    struct const_reverse_iterator_of;
+    
+    //
+    // Special metafunctions
+    //
+    
+    template< class T >
+    struct result_iterator_of;
                  
+    template< class T >
+    struct reverse_result_iterator_of;
+
     //
-    // funtions
+    // Single Pass Range functions
     //
     
     template< class T >
-    inline typename iterator_of::type
+    inline typename iterator_of<T>::type
     begin( T& c );
     
     template< class T >
-    inline typename const_iterator_of< T >::type
+    inline typename const_iterator_of<T>::type
     begin( const T& c );
         
     template< class T >
-    inline typename iterator_of< T >::type
+    inline typename iterator_of<T>::type
     end( T& c );
                       
     template< class T >
-    inline typename const_iterator_of< T >::type
+    inline typename const_iterator_of<T>::type
     end( const T& c );
     
     template< class T >
     inline bool
     empty( const T& c );
                
+    //
+    // Forward Range functions
+    //
+    
     template< class T >
-    inline typename size_type_of< T >::type
+    inline typename size_type_of<T>::type
     size( const T& c );
-                 
-} // namespace 'boost' 
-

- - -

Semantics

-

-In the table C is a type that conforms to the -ExternalCollectionConcept and c is an object of that type. -SC -will denote a standard container, T[sz] will denote an array of -type T of size sz, P will denote -std::pair<>, -I means an iterator which default construction denotes the end of -the range and sc,t,p,i are objects of these types, respectively. -Special cases for char* and wchar_t* are described -explicitly. -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ExpressionReturn typeComplexity
value_type_of<C>::typeSC::value_type
- T
- std::iterator_traits<P::first_type>::value_type
-
compile time
iterator_of<C>::typeSC::iterator
- T*
- P::first_type
-
compile time
const_iterator_of<C>::typeSC::const_iterator
- const T*
- P::first_type
-
compile time
difference_type_of<C>::typeSC::difference_type
- std::ptrdiff_t
- std::iterator_traits<P::first_type>:: difference_type
-
compile time
size_type_of<C>::typeSC::size_type
- std::size_t
- std::size_t
-
compile time
result_iterator_of<C>::typeconst_iterator_of< C>::type if C is - const -
- iterator_of<C>::type otherwise
compile time
reverse_iterator_of<C>::typeboost::reverse_iterator< typename iterator_of<T>::type ->
compile time
const_reverse_iterator_of<C>::typeboost::reverse_iterator< typename const_iterator_of<T>::type >
-
compile time
reverse_result_iterator_of<C>::typeboost::reverse_iterator< typename result_iterator_of<T>:: - type > - compile time
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ExpressionReturn typeReturnsComplexity
begin( c )result_iterator_of<C>::typesc.begin()
- t
- p.first
-
constant time
end( c )result_iterator_of<C>::typesc.end()
- t + std::char_traits<C>::length( t ) if C is - char* - or wchar_t*
- t + sz - 1 if C is char[sz] or - wchar_t[sz] -
- t + sz otherwise
- p.second
-
linear if C is char* or wchar_t* -
- constant time otherwise
empty( c )Convertible to boolsc.empty()
- size( t ) == 0
- p.first == p.second
-
linear if C is char* or wchar_t* -
- constant time otherwise
-
size( c )size_type_of<C>::typesc.size()
- end( t ) - begin( t )
- distance( p. first, p.second )
-
linear if C is char* or wchar_t* -
- or if std::distance() is linear
- constant time otherwise
rbegin( c )reverse_result_iterator_of<C>::typereverse_result_iterator_of<C>::type( end( c ) ) -
-
same as end()
rend( c )reverse_result_iterator_of<C>::typereverse_result_iterator_of<C>::type( begin( c ) ) - same as begin()
- -

-Please note that char*,whar_t*,char[], -and wchar_t[] behaves differently from normal arrays only for -size() -and end(). Note that the null pointer is allowed as an argument -in these cases. -

- - -

Examples

-

-Some examples are given in the accompanying test files: -

- + template< class T > + inline typename reverse_iterator_of<T>::type + rend( T& c ); + + template< class T > + inline typename const_reverse_iterator_of<T>::type + rend( const T& c ); + +} // namespace 'boost'
+

+ + +

Semantics

+ +

notation

+

+ + + + + + + + + + + + + + + +
Type + Object + Describes +
X + x + any type +
T t + denotes behavior of the primary templates
P + p + denotes std::pair<iterator,iterator> +
A[sz] + a + denotes an array of type A of size sz +
Char* + s + denotes either char* or wchar_t* +
+

+ +

+ Please notice in tables below that when four lines appear in a + cell, the first line will describe the primary template, the second + line pairs of iterators, the third line arrays and the last line + null-terminated strings. +

+

Metafunctions

+

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ExpressionReturn typeComplexity
value_type_of<X>::typeT::value_type
+ boost::iterator_value<P::first_type>::type
+ A
+ Char +
compile time
iterator_of<X>::typeT::iterator
+ P::first_type
+ A*
+ Char* +
compile time
const_iterator_of<X>::typeT::const_iterator
+ P::first_type
+ const A*
+ const Char* +
compile time
difference_type_of<X>::typeT::difference_type
+ boost_iterator_difference<P::first_type>::type
+ std::ptrdiff_t
+ std::ptrdiff_t
+
compile time
size_type_of<X>::typeT::size_type
+ std::size_t
+ std::size_t
+ std::size_t
+
compile time
result_iterator_of<X>::typeconst_iterator_of<X>::type if X is const
+ iterator_of<X>::type otherwise
compile time
reverse_iterator_of<X>::typeboost::reverse_iterator< typename iterator_of<T>::type >
+
compile time
const_reverse_iterator_of<X>::typeboost::reverse_iterator< typename const_iterator_of<T>::type > +
+
compile time
reverse_result_iterator_of<X>::typeboost::reverse_iterator< typename result_iterator_of<T>::type > + compile time
+

+

+ The special metafunctions result_iterator_of and + reverse_result_iterator_of 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

+

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ExpressionReturn typeReturnsComplexity
begin(x)result_iterator_of<X>::typet.begin()
+ p.first
+ a
+ s +
constant time
end(x)result_iterator_of<X>::typet.end()
+ p.second
+ a + sz
+ s + std::char_traits<X>::length( s ) if +X is Char*
+ s + sz - 1 if X is Char[sz]
+ + +
linear if X is Char*
+ constant time otherwise
empty(x)boolbegin(x) == end( x )
+
linear if X is Char*
+ constant time otherwise
+
size(x)size_type_of<X>::typet.size()
+ std::distance(p.first,p.second)
+ sz
+ end(s) - s + +
linear if X is Char*
+ or if std::distance() is linear
+ constant time otherwise
rbegin(x)reverse_result_iterator_of<X>::typereverse_result_iterator_of<X>::type( end(x) +)
same as end(x)
rend(x)reverse_result_iterator_of<X>::typereverse_result_iterator_of<X>::type( begin(x) +) same as begin(x)
+

+

diff --git a/doc/examples.html b/doc/examples.html new file mode 100755 index 0000000..a13db75 --- /dev/null +++ b/doc/examples.html @@ -0,0 +1,64 @@ + + + + + + Boost.Range Examples + + + + + + + + + + +

Boost.Range

+ +

Examples

+

+ Some examples are given in the accompanying test files: +

+ + +
+

+ (C) Copyright Thorsten Ottosen 2003-2004 +

+ +
+
+
+
+
+
+
+
+
+
+
+
+ + + + + diff --git a/index.html b/index.html index fc6fce6..5789943 100755 --- a/index.html +++ b/index.html @@ -44,20 +44,15 @@
  • RandomAccessRange -
  • Implementation of Range concepts for - -
  • Utilities: +
  • Implementation of Range concepts +
  • Utilities:
  • Terminology and style guidelines
  • Headers
  • +
  • Examples
  • Portability
  • FAQ
  • History and acknowledgment