diff --git a/doc/filter_iterator.html b/doc/filter_iterator.html index fe607cd..bba015f 100644 --- a/doc/filter_iterator.html +++ b/doc/filter_iterator.html @@ -52,15 +52,15 @@ sequence to be traversed.

Table of Contents

-

filter_iterator synopsis

+

filter_iterator synopsis

@@ -95,13 +95,17 @@ private: Iterator m_end; // exposition only }; -

If Iterator models Readable Lvalue Iterator and Forward Traversal +

If Iterator models Readable Lvalue Iterator and Bidirectional Traversal Iterator then iterator_category is convertible to -std::forward_iterator_tag. Otherwise iterator_category is +std::bidirectional_iterator_tag. +Otherwise, if Iterator models Readable Lvalue Iterator and Forward Traversal +Iterator then iterator_category is convertible to +std::forward_iterator_tag. +Otherwise iterator_category is convertible to std::input_iterator_tag.

-
-

filter_iterator requirements

+
+

filter_iterator requirements

The Iterator argument shall meet the requirements of Readable Iterator and Single Pass Iterator or it shall meet the requirements of Input Iterator.

@@ -112,14 +116,14 @@ the expression p(x) must be va p(x) must be convertible to bool.

-

filter_iterator models

+

filter_iterator models

The concepts that filter_iterator models are dependent on which concepts the Iterator argument models, as specified in the following tables.

--++ @@ -133,6 +137,9 @@ following tables.

+ + +
If Iterator models
Forward Traversal Iterator Forward Traversal Iterator
Bidirectional Traversal IteratorBidirectional Traversal Iterator
@@ -177,13 +184,16 @@ following tables.

+ + +
Writable Lvalue Iterator, Forward Traversal Iterator Mutable Forward Iterator
Writable Lvalue Iterator, Bidirectional IteratorMutable Bidirectional Iterator

filter_iterator<P1, X> is interoperable with filter_iterator<P2, Y> if and only if X is interoperable with Y.

-
-

filter_iterator operations

+
+

filter_iterator operations

In addition to those operations required by the concepts that filter_iterator models, filter_iterator provides the following operations.

@@ -319,7 +329,7 @@ make_filter_iterator(Iterator x, Iterator end = Iterator());
-

Example

+

Example

This example uses filter_iterator and then make_filter_iterator to output only the positive integers from an array of integers. Then make_filter_iterator is is used to output diff --git a/doc/filter_iterator.pdf b/doc/filter_iterator.pdf index 2e5d9bb..031ea64 100755 Binary files a/doc/filter_iterator.pdf and b/doc/filter_iterator.pdf differ diff --git a/doc/filter_iterator_ref.html b/doc/filter_iterator_ref.html index fe3fde8..0ffd956 100755 --- a/doc/filter_iterator_ref.html +++ b/doc/filter_iterator_ref.html @@ -43,12 +43,16 @@ private: Iterator m_end; // exposition only }; -

If Iterator models Readable Lvalue Iterator and Forward Traversal +

If Iterator models Readable Lvalue Iterator and Bidirectional Traversal Iterator then iterator_category is convertible to -std::forward_iterator_tag. Otherwise iterator_category is +std::bidirectional_iterator_tag. +Otherwise, if Iterator models Readable Lvalue Iterator and Forward Traversal +Iterator then iterator_category is convertible to +std::forward_iterator_tag. +Otherwise iterator_category is convertible to std::input_iterator_tag.

-
-

filter_iterator requirements

+
+

filter_iterator requirements

The Iterator argument shall meet the requirements of Readable Iterator and Single Pass Iterator or it shall meet the requirements of Input Iterator.

@@ -65,8 +69,8 @@ concepts the Iterator argument following tables.

--++ @@ -80,6 +84,9 @@ following tables.

+ + +
If Iterator models
Forward Traversal Iterator Forward Traversal Iterator
Bidirectional Traversal IteratorBidirectional Traversal Iterator
@@ -124,13 +131,16 @@ following tables.

+ + +
Writable Lvalue Iterator, Forward Traversal Iterator Mutable Forward Iterator
Writable Lvalue Iterator, Bidirectional IteratorMutable Bidirectional Iterator

filter_iterator<P1, X> is interoperable with filter_iterator<P2, Y> if and only if X is interoperable with Y.

-
-

filter_iterator operations

+
+

filter_iterator operations

In addition to those operations required by the concepts that filter_iterator models, filter_iterator provides the following operations.

diff --git a/doc/filter_iterator_ref.rst b/doc/filter_iterator_ref.rst index 80c6182..1759788 100644 --- a/doc/filter_iterator_ref.rst +++ b/doc/filter_iterator_ref.rst @@ -35,9 +35,13 @@ }; -If ``Iterator`` models Readable Lvalue Iterator and Forward Traversal +If ``Iterator`` models Readable Lvalue Iterator and Bidirectional Traversal Iterator then ``iterator_category`` is convertible to -``std::forward_iterator_tag``. Otherwise ``iterator_category`` is +``std::bidirectional_iterator_tag``. +Otherwise, if ``Iterator`` models Readable Lvalue Iterator and Forward Traversal +Iterator then ``iterator_category`` is convertible to +``std::forward_iterator_tag``. +Otherwise ``iterator_category`` is convertible to ``std::input_iterator_tag``. @@ -62,13 +66,15 @@ The concepts that ``filter_iterator`` models are dependent on which concepts the ``Iterator`` argument models, as specified in the following tables. -+-----------------------------+----------------------------------------------------------+ -| If ``Iterator`` models | then ``filter_iterator`` models | -+=============================+==========================================================+ -| Single Pass Iterator | Single Pass Iterator | -+-----------------------------+----------------------------------------------------------+ -| Forward Traversal Iterator | Forward Traversal Iterator | -+-----------------------------+----------------------------------------------------------+ ++---------------------------------+------------------------------------------+ +|If ``Iterator`` models |then ``filter_iterator`` models | ++=================================+==========================================+ +|Single Pass Iterator |Single Pass Iterator | ++---------------------------------+------------------------------------------+ +|Forward Traversal Iterator |Forward Traversal Iterator | ++---------------------------------+------------------------------------------+ +|Bidirectional Traversal Iterator |Bidirectional Traversal Iterator | ++---------------------------------+------------------------------------------+ +--------------------------------+----------------------------------------------+ | If ``Iterator`` models | then ``filter_iterator`` models | @@ -81,13 +87,15 @@ following tables. +--------------------------------+----------------------------------------------+ +-------------------------------------------------------+---------------------------------+ -| If ``Iterator`` models | then ``filter_iterator`` models | +|If ``Iterator`` models | then ``filter_iterator`` models | +=======================================================+=================================+ -| Readable Iterator, Single Pass Iterator | Input Iterator | +|Readable Iterator, Single Pass Iterator | Input Iterator | +-------------------------------------------------------+---------------------------------+ -| Readable Lvalue Iterator, Forward Traversal Iterator | Forward Iterator | +|Readable Lvalue Iterator, Forward Traversal Iterator | Forward Iterator | +-------------------------------------------------------+---------------------------------+ -| Writable Lvalue Iterator, Forward Traversal Iterator | Mutable Forward Iterator | +|Writable Lvalue Iterator, Forward Traversal Iterator | Mutable Forward Iterator | ++-------------------------------------------------------+---------------------------------+ +|Writable Lvalue Iterator, Bidirectional Iterator | Mutable Bidirectional Iterator | +-------------------------------------------------------+---------------------------------+ diff --git a/doc/rst2latex b/doc/rst2latex index 795610c..3636587 100755 --- a/doc/rst2latex +++ b/doc/rst2latex @@ -1,4 +1,4 @@ #!/bin/sh PYTHONPATH="c:/src/docutils/docutils;c:/src/docutils/docutils/extras" export PYTHONPATH -python c:/src/docutils/docutils/tools/rst2latex.py --documentoptions pdftex --stylesheet=docutils.sty --embed-stylesheet $1 `echo $1 | sed 's/\(.*\)\..*/\1.tex/'` +python c:/src/docutils/docutils/tools/rst2latex.py --documentoptions pdftex --stylesheet=docutils.sty $1 `echo $1 | sed 's/\(.*\)\..*/\1.tex/'` diff --git a/include/boost/iterator/filter_iterator.hpp b/include/boost/iterator/filter_iterator.hpp index 0edede5..96fb843 100644 --- a/include/boost/iterator/filter_iterator.hpp +++ b/include/boost/iterator/filter_iterator.hpp @@ -31,9 +31,9 @@ namespace boost , typename mpl::if_< is_convertible< typename iterator_traversal::type - , bidirectional_traversal_tag + , random_access_traversal_tag > - , forward_traversal_tag + , bidirectional_traversal_tag , use_default >::type > type; diff --git a/test/filter_iterator_test.cpp b/test/filter_iterator_test.cpp index 8dc9e1d..f4eb635 100644 --- a/test/filter_iterator_test.cpp +++ b/test/filter_iterator_test.cpp @@ -63,6 +63,32 @@ int main() boost::function_requires< boost_concepts::WritableIteratorConcept >(); boost::function_requires< boost_concepts::ForwardTraversalConcept >(); } + { + typedef boost::filter_iterator > Iter; + boost::function_requires< boost::BidirectionalIteratorConcept >(); + boost::function_requires< boost_concepts::ReadableIteratorConcept >(); + boost::function_requires< boost_concepts::BidirectionalTraversalConcept >(); + } + { + typedef boost::filter_iterator > Iter; + boost::function_requires< boost::Mutable_BidirectionalIteratorConcept >(); + boost::function_requires< boost_concepts::ReadableIteratorConcept >(); + boost::function_requires< boost_concepts::WritableIteratorConcept >(); + boost::function_requires< boost_concepts::BidirectionalTraversalConcept >(); + } + { + typedef boost::filter_iterator > Iter; + boost::function_requires< boost::BidirectionalIteratorConcept >(); + boost::function_requires< boost_concepts::ReadableIteratorConcept >(); + boost::function_requires< boost_concepts::BidirectionalTraversalConcept >(); + } + { + typedef boost::filter_iterator > Iter; + boost::function_requires< boost::Mutable_BidirectionalIteratorConcept >(); + boost::function_requires< boost_concepts::ReadableIteratorConcept >(); + boost::function_requires< boost_concepts::WritableIteratorConcept >(); + boost::function_requires< boost_concepts::BidirectionalTraversalConcept >(); + } // Adapting new-style iterators { typedef boost::iterator_archetype< @@ -141,6 +167,56 @@ int main() } #endif + { + typedef boost::iterator_archetype< + const dummyT + , boost::iterator_archetypes::readable_iterator_t + , boost::random_access_traversal_tag + > BaseIter; + typedef boost::filter_iterator Iter; + boost::function_requires< boost::InputIteratorConcept >(); + boost::function_requires< boost_concepts::ReadableIteratorConcept >(); + boost::function_requires< boost_concepts::BidirectionalTraversalConcept >(); + } + +#if !BOOST_WORKAROUND(BOOST_MSVC, == 1200) // Causes Internal Error in linker. + { + typedef boost::iterator_archetype< + dummyT + , boost::iterator_archetypes::readable_writable_iterator_t + , boost::random_access_traversal_tag + > BaseIter; + typedef boost::filter_iterator Iter; + boost::function_requires< boost_concepts::ReadableIteratorConcept >(); + boost::function_requires< boost_concepts::WritableIteratorConcept >(); + boost::function_requires< boost_concepts::BidirectionalTraversalConcept >(); + } + { + typedef boost::iterator_archetype< + const dummyT + , boost::iterator_archetypes::readable_lvalue_iterator_t + , boost::random_access_traversal_tag + > BaseIter; + typedef boost::filter_iterator Iter; + boost::function_requires< boost::BidirectionalIteratorConcept >(); + boost::function_requires< boost_concepts::ReadableIteratorConcept >(); + boost::function_requires< boost_concepts::LvalueIteratorConcept >(); + boost::function_requires< boost_concepts::BidirectionalTraversalConcept >(); + } + { + typedef boost::iterator_archetype< + dummyT + , boost::iterator_archetypes::writable_lvalue_iterator_t + , boost::random_access_traversal_tag + > BaseIter; + typedef boost::filter_iterator Iter; + boost::function_requires< boost::Mutable_BidirectionalIteratorConcept >(); + boost::function_requires< boost_concepts::WritableIteratorConcept >(); + boost::function_requires< boost_concepts::LvalueIteratorConcept >(); + boost::function_requires< boost_concepts::BidirectionalTraversalConcept >(); + } +#endif + // Run-time tests dummyT array[] = { dummyT(0), dummyT(1), dummyT(2),