@@ -604,14 +414,16 @@ into the temporary iterator p+noperator[] returns.
Writable iterators built with iterator_facade implement the
semantics required by the preferred resolution to issue 299 and
-adopted by proposal n1550: the result of p[n] is a proxy object
-containing a copy of p+n, and p[n]=x is equivalent to *(p
-+n)=x. This approach will work properly for any random-access
-iterator regardless of the other details of its implementation. A
-user who knows more about the implementation of her iterator is free
-to implement an operator[] which returns an lvalue in the derived
-iterator class; it will hide the one supplied by iterator_facade
-from clients of her iterator.
+adopted by proposal n1550: the result of p[n] is an object
+convertible to the iterator's value_type, and p[n]=x is
+equivalent to *(p+n)=x (Note: This result object may be
+implemented as a proxy containing a copy of p+n). This approach
+will work properly for any random-access iterator regardless of the
+other details of its implementation. A user who knows more about
+the implementation of her iterator is free to implement an
+operator[] that returns an lvalue in the derived iterator
+class; it will hide the one supplied by iterator_facade from
+clients of her iterator.
an object convertible to reference and holding a copy
-p of *static_cast<Derivedconst*>(this)+n such that, for a constant object v of type
-value_type, (*static_cast<Derivedconst*>(this))[n]=v is equivalent
-to p=v.
+
Returns:
an object convertible to value_type. For constant
+objects v of type value_type, and n of type
+difference_type, and reference p equal to
+*static_cast<Derivedconst*>(this), (*this)[n]=v is
+equivalent to *(p+n)=v, and static_cast<value_type
+const&>((*this)[n]) is equivalent to
+static_cast<value_typeconst&>(*(p+n))
@@ -1814,13 +1629,14 @@ iterator and the end of the range.
The iterator_category is a type convertible to the tags
+corresponding to each standard concept modeled by filter_iterator,
+as described in the models section.
The base Iterator parameter must be a model of Readable
-Iterator and Single Pass Iterator. The resulting
-filter_iterator will be a model of Forward Traversal Iterator
-if Iterator is, otherwise the filter_iterator will be a
-model of Single Pass Iterator. The access category of the
-filter_iterator will be the same as the access category of
-Iterator.
-
-
The Predicate must be Assignable, Copy Constructible, and the
-expression p(x) must be valid where p is an object of type
+
The Predicate argument must be Assignable, Copy Constructible, and
+the expression p(x) must be valid where p is an object of type
Predicate, x is an object of type
iterator_traits<Iterator>::value_type, and where the type of
p(x) must be convertible to bool.
+
The Iterator argument shall meet the requirements of Readable
+Iterator and Single Pass Iterator or it shall meet the requirements of
+Input Iterator.
The counting iterator adaptor implements dereference by returning a
reference to the base object. The other operations are implemented by
the base m_iterator, as per the inheritance from
iterator_adaptor.
The Incrementable type must be Default Constructible, Copy
Constructible, and Assignable. The default distance is
an implementation defined signed integegral type.
The function output iterator adaptor makes it easier to create custom
output iterators. The adaptor takes a unary function and creates a
model of Output Iterator. Each item assigned to the output iterator is
@@ -2056,7 +1949,7 @@ iterator is that creating a conforming output iterator is non-trivial,
particularly because the proper implementation usually requires a
proxy object.
The UnaryFunction must be Assignable, Copy Constructible, and the
expression f(x) must be valid, where f is an object of type
UnaryFunction and x is an object of a type accepted by f.
@@ -2092,7 +1985,7 @@ The resulting function_output_iterator
+template <class Predicate, class Iterator>
+filter_iterator<Predicate,Iterator>
+make_filter_iterator(Predicate f, Iterator x, Iterator end = Iterator());
+
+
+
+
+
+
Returns:
An instance of filter_iterator<Predicate,Iterator> at
+the first position in the range [x,end) such that
+f(*this->base())==true or else at position end.
+
+
+
+
+template <class Predicate, class Iterator>
+filter_iterator<Predicate,Iterator>
+make_filter_iterator(Iterator x, Iterator end = Iterator());
+
+
+
+
+
+
Returns:
An instance of filter_iterator<Predicate,Iterator> at
+the first position in the range [x,end)
+such that f(*this->base())==true, where f is a default
+constructed Predicate, or else at position end.
This example uses filter_iterator to output only the positive
-integers from an array of integers.
+
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
+the integers greater than -2.
@@ -412,14 +225,16 @@ into the temporary iterator p+noperator[] returns.
Writable iterators built with iterator_facade implement the
semantics required by the preferred resolution to issue 299 and
-adopted by proposal n1550: the result of p[n] is a proxy object
-containing a copy of p+n, and p[n]=x is equivalent to *(p
-+n)=x. This approach will work properly for any random-access
-iterator regardless of the other details of its implementation. A
-user who knows more about the implementation of her iterator is free
-to implement an operator[] which returns an lvalue in the derived
-iterator class; it will hide the one supplied by iterator_facade
-from clients of her iterator.
+adopted by proposal n1550: the result of p[n] is an object
+convertible to the iterator's value_type, and p[n]=x is
+equivalent to *(p+n)=x (Note: This result object may be
+implemented as a proxy containing a copy of p+n). This approach
+will work properly for any random-access iterator regardless of the
+other details of its implementation. A user who knows more about
+the implementation of her iterator is free to implement an
+operator[] that returns an lvalue in the derived iterator
+class; it will hide the one supplied by iterator_facade from
+clients of her iterator.
In this section we'll walk through the implementation of a few
+iterators using iterator_facade, based around the simple
+example of a linked list of polymorphic objects.
The following table describes the typical valid expressions on
iterator_facade's Derived parameter, depending on the
iterator concept(s) it will model. The operations in the first
@@ -647,7 +532,7 @@ Iterator
The operations in this section are described in terms of operations on
the core interface of Derived which may be inaccessible
(i.e. private). The implementation should access these operations
@@ -736,10 +621,13 @@ of type pointer equal to:
-
Returns:
an object convertible to reference and holding a copy
-p of *static_cast<Derivedconst*>(this)+n such that, for a constant object v of type
-value_type, (*static_cast<Derivedconst*>(this))[n]=v is equivalent
-to p=v.
+
Returns:
an object convertible to value_type. For constant
+objects v of type value_type, and n of type
+difference_type, and reference p equal to
+*static_cast<Derivedconst*>(this), (*this)[n]=v is
+equivalent to *(p+n)=v, and static_cast<value_type
+const&>((*this)[n]) is equivalent to
+static_cast<value_typeconst&>(*(p+n))
@@ -840,11 +728,5 @@ return tmp -= n;
-
-
diff --git a/doc/make_counting_iterator.rst b/doc/make_counting_iterator.rst
new file mode 100755
index 0000000..f1c9ae9
--- /dev/null
+++ b/doc/make_counting_iterator.rst
@@ -0,0 +1,9 @@
+
+::
+
+ template
+ counting_iterator make_counting_iterator(Incrementable x);
+
+:Returns: An instance of ``counting_iterator``
+ with ``current`` constructed from ``x``.
+
diff --git a/doc/make_filter_iterator.rst b/doc/make_filter_iterator.rst
new file mode 100755
index 0000000..8400d9d
--- /dev/null
+++ b/doc/make_filter_iterator.rst
@@ -0,0 +1,21 @@
+
+::
+
+ template
+ filter_iterator
+ make_filter_iterator(Predicate f, Iterator x, Iterator end = Iterator());
+
+:Returns: An instance of ``filter_iterator`` at
+ the first position in the range ``[x,end)`` such that
+ ``f(*this->base()) == true`` or else at position ``end``.
+
+::
+
+ template
+ filter_iterator
+ make_filter_iterator(Iterator x, Iterator end = Iterator());
+
+:Returns: An instance of ``filter_iterator`` at
+ the first position in the range ``[x,end)``
+ such that ``f(*this->base()) == true``, where ``f`` is a default
+ constructed ``Predicate``, or else at position ``end``.
\ No newline at end of file
diff --git a/doc/make_reverse_iterator.rst b/doc/make_reverse_iterator.rst
new file mode 100644
index 0000000..c3e20ed
--- /dev/null
+++ b/doc/make_reverse_iterator.rst
@@ -0,0 +1,9 @@
+::
+
+ template
+ reverse_iteratorn
+ make_reverse_iterator(BidirectionalIterator x);
+
+:Returns: An instance of ``reverse_iterator``
+ with a ``current`` constructed from ``x``.
+
diff --git a/doc/new-iter-concepts.html b/doc/new-iter-concepts.html
index 8ea5c49..8b40d3e 100755
--- a/doc/new-iter-concepts.html
+++ b/doc/new-iter-concepts.html
@@ -3,204 +3,13 @@
-
+
New Iterator Concepts
-
+
@@ -1072,11 +881,5 @@ LocalWords: incrementable xxx min prev inplace png oldeqnew AccessTag struct
LocalWords: TraversalTag typename lvalues DWA Hmm JGS mis enum -->
The type AdaptableUnaryFunction must be Assignable, Copy
-Constructible, and the expression f(x) must be valid where f
-is an object of type AdaptableUnaryFunction, x is an object of
-type AdaptableUnaryFunction::argument_type, and where the type of
-f(x) must be AdaptableUnaryFunction::result_type.
+
The type UnaryFunction must be Assignable, Copy Constructible, and
+the expression f(*i) must be valid where f is an object of
+type UnaryFunction, i is an object of type Iterator, and
+where the type of f(*i) must be
+result_of<UnaryFunction(iterator_traits<Iterator>::reference)>::type.
The type Iterator must at least model Readable Iterator. The
resulting transform_iterator models the most refined of the
following options that is also modeled by Iterator.
-
Writable Lvalue Iterator if the result_type of the
-AdaptableUnaryFunction is a non-const reference.
-
Readable Lvalue Iterator if the result_type is a const
+
Writable Lvalue Iterator if result_of<UnaryFunction(iterator_traits<Iterator>::reference)>::type is a non-const reference.
+
Readable Lvalue Iterator if result_of<UnaryFunction(iterator_traits<Iterator>::reference)>::type is a const
reference.
Readable Iterator otherwise.
The transform_iterator models the most refined standard traversal
concept that is modeled by Iterator.
-
The value_type of transform_iterator is
-remove_reference<result_type>::type. The reference type is
-result_type.
+
The reference type of transform_iterator is
+result_of<UnaryFunction(iterator_traits<Iterator>::reference)>::type.
+The value_type is remove_cv<remove_reference<reference>>::type.