diff --git a/doc/faq.html b/doc/faq.html index 903f4d5..b3f302f 100755 --- a/doc/faq.html +++ b/doc/faq.html @@ -30,11 +30,15 @@
Note that an iterator_range
-is somewhat more convenient than a pair
.
pair
and that a sub_range
do
+ propagate const-ness.
+
- The library have been kept small because its current interface will serve most + The library has been kept small because its current interface will + serve most purposes. If and when a genuine need arises for more functionality, it can be implemented.
@@ -55,9 +59,14 @@ is somewhat more convenient than apair
.
Even though we speak of incrementable iterators, it would not make
much sense for ranges; for example, we cannot determine the size and
emptiness of a range since we cannot even compare
- its iterators.
+ its iterators.
+ + Note also that incrementable iterators are derived from output + iterators and so there exist no output range. +
diff --git a/doc/intro.html b/doc/intro.html index 7845f21..6b5871d 100755 --- a/doc/intro.html +++ b/doc/intro.html @@ -18,17 +18,30 @@
- Pavol Droba for help with documentation and implementation
- Pavel Vozenilek for help with porting the library -
- Jonathan Turkanis for help with documentation +
- Jonathan Turkanis and John Torjo for help with documentation
- Hartmut Kaiser for being review manager
Introduction
- When writing generic code that works with standard library containers, one -often finds it desirable to extend that code to work with other types that offer - enough functionality to satisfy the needs of the generic code, but in an altered - form. For example, raw arrays are often suitable for use with generic code that + Generic algorithms have so far been specified in terms of two or more + iterators. Two iterators would together form a range of values that the + algorithm could work on. This leads to a very general interface, but also + to a somewhat clumsy use of the algorithms with redundant specification + of container names. Therefore we would like to raise the abstraction level + for algorithms so they specify their interface in terms of Ranges as much as possible. +
+ ++ The most common form of ranges we are used to work with is standard library + containers. However, one + often finds it desirable to extend that code to work with other types that + offer + 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.
- This library provides the means to adapt standard library + 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. @@ -51,17 +64,17 @@ free-standing functions so syntactic and/or semantic differences can be removed. The main advantages are@@ -112,9 +125,9 @@ class=identifier>ForwardReadableRange >::
- - simpler implementation of generic range algorithms + simpler implementation and specification of generic range algorithms
- - more flexible client code + more flexible, compact and maintainable client code
- correct handling of null-terminated strings
- safe use of built-in arrays (for legacy code; why else would you use -arrays?)
+ built-in arrays?)my_vector.assign( values, boost::end( values ) ); - typedef std::vector<int>::range_iterator range_iterator; - std::pair<range_iterator,range_iterator> my_view( boost::begin( my_vector ), - boost::begin( my_vector ) + N ); + typedef std::vector<int>::iterator iterator; + std::pair<iterator,iterator> my_view( boost::begin( my_vector ), + boost::begin( my_vector ) + N ); char str_val[] = "a string"; char* str = str_val; diff --git a/doc/portability.html b/doc/portability.html index 272dfe3..70b5750 100755 --- a/doc/portability.html +++ b/doc/portability.html @@ -17,28 +17,53 @@Portability
-- Full support for built-in arrays require that the compiler supports class - template partial specialization. For non-conforming compilers there might - be a chance that it works anyway thanks to workarounds in the type traits - library.
-- Notice that some compilers cannot do function template ordering properly. In - that case one must rely of
result_iterator_of
and a - single function definition instead of - overloaded versions for const and non-const arguments. - - - So if one cares about old compilers, one should not pass rvalues - to the functions. + ++ A huge effort has been made to port the library to as many compilers as possible. + The results of the test-suites can be found here.
- A huge effort has been made to port the library to as many compilers as - possible. The results of the test-suites can be found - here. + Full support for built-in arrays require that the compiler supports class + template partial specialization. For non-conforming compilers there might be a + chance that it works anyway thanks to workarounds in the type traits library.
- ++ Notice also that some compilers cannot do function template ordering properly. + In that case one must rely of
+ +range_result_iterator
+ and a single function definition instead of overloaded versions for const and + non-const arguments. + + So if one cares about old compilers, one should not pass rvalues to the + functions. ++ For maximum portability you should follow these guidelines: + +
+
+ +- + do not use built-in arrays +
- + do not pass rvalues to
begin()
,end()
and +iterator_range
Range constructors and assignment operators, + +- + do not rely on ADL: +
+
+ +- + if you overload functions, include that header before the headers in this + library, +
- + put all overloads in namespace
boost
, +
(C) Copyright Thorsten Ottosen 2003-2004 diff --git a/doc/range.html b/doc/range.html index 1d2a677..9e92268 100755 --- a/doc/range.html +++ b/doc/range.html @@ -68,8 +68,8 @@ - Because of the second requirement, a Range object must be passed by reference in - generic code. + Because of the second requirement, a Range object must be passed by + (const or non-const) reference in generic code.
diff --git a/doc/utility_class.html b/doc/utility_class.html index 68ca47f..395c922 100644 --- a/doc/utility_class.html +++ b/doc/utility_class.html @@ -54,7 +54,7 @@ corresponding
The intention of theconst_iterator
is.iterator_range
class is to encapsulate two iterators so they fulfill the Forward Range concept. A few other -functions are also provided for convenience. + functions are also provided for convenience.If the template argument is not a model of Forward Traversal Iterator, one can @@ -63,6 +63,16 @@ functions are also provided for convenience. 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. +Synopsis