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 @@ -
+ +![]() |
+
|
+
![]() |
-
|
-
+ Four types of objects are currently supported by the library: +
std::pair<iterator,iterator>
+ char[]
,wchar_t[]
,
+ char*
, and wchar_t*
)
+ iterator_range
implements the minimal interface required to make the class
+ a Forward Range.
+
+
+ + Please also see Range concepts for more details. +
+ + +-
-Five types of objects are currently supported by the library: -
std::pair<iterator,iterator>
- char[]
,wchar_t[]
,
- char*
, and wchar_t*
)
- 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.
-
- -
+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 andc
is an object of that type.-SC
-will denote a standard container,T[sz]
will denote an array of -typeT
of sizesz
,P
will denote-std::pair<>
, -I
means an iterator which default construction denotes the end of -the range andsc,t,p,i
are objects of these types, respectively. -Special cases forchar*
andwchar_t*
are described -explicitly. -
-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.
-
-Some examples are given in the accompanying test files: -
-iterator.cpp
- std::copy()
that
- works with std::ifstream_iterator<>.
- string.cpp
- std::find()
that
- works with char[],wchar_t[],char*,wchar_t*.
- algorithm_example.cpp
+
+ //
+ // Bidirectional Range functions
+ //
+
+ template< class T >
+ inline typename reverse_iterator_of<T>::type
+ rbegin( T& c );
+
+ template< class T >
+ inline typename const_reverse_iterator_of<T>::type
+ rbegin( const T& c );
- +
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. +
++
+ 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.
+
+
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 |
+
+ Some examples are given in the accompanying test files: +
+string.cpp
+ std::find()
that
+ works with char[],wchar_t[],char*,wchar_t*.
+ algorithm_example.cpp
+
+ + (C) Copyright Thorsten Ottosen 2003-2004 +
+ +iterator_range
sub_range