diff --git a/doc/counting_iterator_ref.rst b/doc/counting_iterator_ref.rst
index fc01011..f443682 100644
--- a/doc/counting_iterator_ref.rst
+++ b/doc/counting_iterator_ref.rst
@@ -1,12 +1,18 @@
::
- template 2003-09-22
-Number: This document is a revised version of the official N1476=03-0059
+Number: N1530=03-0113
@@ -642,17 +642,18 @@ above. The Base type need not
iterator. It need only support the operations used by the core
interface functions of iterator_adaptor that have not been
redefined in the user's derived class.Copyright:
Copyright David Abrahams, Jeremy Siek, and Thomas Witt 2003. All rights reserved
Several of the template parameters of iterator_adaptor default to -use_default. This allows the user to make use of a default -parameter even when the user wants to specify a parameter later in the -parameter list. Also, the defaults for the corresponding associated -types are fairly complicated, so metaprogramming is required to -compute them, and use_default can help to simplify the -implementation. Finally, use_default is not left unspecified +
Several of the template parameters of iterator_adaptor default +to use_default (or use_default_access). This allows the +user to make use of a default parameter even when she wants to +specify a parameter later in the parameter list. Also, the +defaults for the corresponding associated types are somewhat +complicated, so metaprogramming is required to compute them, and +use_default can help to simplify the implementation. Finally, +the identity of the use_default type is not left unspecified because specification helps to highlight that the Reference template parameter may not always be identical to the iterator's -reference type, and will keep users making mistakes based on that -assumption.
+reference type, and will keep users making mistakes based on +that assumption.struct use_default; +const unsigned use_default_access = -1; struct iterator_core_access { /* implementation detail */ }; template < class Derived , class Value - , class AccessCategory + , unsigned AccessCategory , class TraversalCategory , class Reference = Value& , class Difference = ptrdiff_t @@ -714,7 +716,8 @@ template < class Derived , class Base , class Value = use_default - , class Category = use_default + , unsigned Access = use_default_access + , class Traversal = use_default , class Reference = use_default , class Difference = use_default > @@ -723,7 +726,8 @@ class iterator_adaptor; template < class Iterator , class Value = use_default - , class Category = use_default + , unsigned Access = use_default_access + , class Traversal = use_default , class Reference = use_default , class Difference = use_default > @@ -745,7 +749,8 @@ class filter_iterator; template < class Incrementable - , class Category = use_default + , unsigned Access = use_default_access + , class Traversal = use_default , class Difference = use_default > class counting_iterator @@ -765,7 +770,7 @@ and associated types, to be supplied by a derived iterator class. template < class Derived , class Value - , class AccessCategory + , unsigned AccessCategory , class TraversalCategory , class Reference = /* see below */ , class Difference = ptrdiff_t @@ -855,11 +860,21 @@ out of the overload set when the types are not interoperable.] title prevents an automatic link from being generated -->iterator_facade requirements
+Some of the constraints on template parameters to +iterator_facade are expressed in terms of resulting nested +types and should be viewed in the context of their impact on +iterator_traits<Derived>.
The Derived template parameter must be a class derived from iterator_facade.
-The default for the Reference parameter is Value& if the -access category for iterator_facade is implicitly convertible to -writable_iterator_tag, and const Value& otherwise.
+The nested ::value_type type will be the same as +remove_cv<Value>::type, so the Value parameter must be +an (optionally const-qualified) non-reference type.
+AccessCategory must be an unsigned value which uses no more +bits than the greatest value of iterator_access.
+The nested ::reference will be the same as the Reference +parameter; it must be a suitable reference type for the resulting +iterator. The default for the Reference parameter is +Value&.
The following table describes the other requirements on the Derived parameter. Depending on the resulting iterator's iterator_category, a subset of the expressions listed in the table @@ -973,8 +988,8 @@ of type X::pointer equal to:
Otherwise returns an object of unspecified type such that, given an object a of type X, a->m is equivalent to (w = *a, w.m) for some temporary object w of type X::value_type.
-The type X::pointer is Value* if the access category for -X is implicitly convertible to writable_iterator_tag, and +
The type X::pointer is Value* if +is_writable_iterator<X>::value is true, and Value const* otherwise.
@@ -1107,11 +1122,13 @@ core interface functions of iterator_facadClass template iterator_adaptor
+bool template < class Derived , class Base , class Value = use_default - , class Category = use_default + , unsigned Access = use_default_access + , class Traversal = use_default , class Reference = use_default , class Difference = use_default > @@ -1163,54 +1180,47 @@ parameters specify the types for the member typedefs in iterator_facade. The following pseudo-code specifies the traits types for iterator_adaptor.-if (Value == use_default) - value_type = iterator_traits<Base>::value_type; -else - value_type = remove_cv<Value>::type; - -if (Reference == use_default) { - if (Value == use_default) - reference = iterator_traits<Base>::reference; - else - reference = Value&; -} else - reference = Reference; - -if (Distance == use_default) - difference_type = iterator_traits<Base>::difference_type; +if (Value != use_default) + value_type = remove_cv<Value>::type; else - difference_type = Distance; + value_type = iterator_traits<Base>::value_type; -if (Category == use_default) - iterator_category = iterator_tag< - access_category< Base >, - traversal_category< Base > - > -else if (Category is convertible to a standard access tag) - iterator_category = iterator_tag< - Category - else if (Category has a nested traversal type) - if (reference is not a reference-to-const) - Category::access - else - if (Category - -else if (Category is convertable to a standard traversal tag) - ... +if (Traversal != use_default) + traversal_category = Traversal else - iterator_category = Category; - // Actually the above is wrong. See the use of - // access_category_tag and - // new_category_to_access/iter_category_to_access. + traversal_category = traversal_category< Base >::type + +iterator_category = iterator_tag< + access_category + , traversal_category + > + +if (Access != use_default) +{ + access_category = Access +} +else +{ + access_category + = access_category< Base >::value + + if (is_const<Value>) + access_category &= ~writable_iterator; +} + +iterator_category = iterator_tag< + access_category + , traversal_category + > + +if (Reference != use_default) + reference = Reference +else if (Value != use_default) + reference = Value& +else + reference = iterator_traits<Base>::reference-iterator_adaptor public operations
@@ -1362,7 +1372,8 @@ iterators over smart pointers, which the impl handles. -JGS --> template < class Iterator , class Value = use_default - , class Category = use_default + , unsigned Access = use_default_access + , class Traversal = use_default , class Reference = use_default , class Difference = use_default > @@ -1374,12 +1385,12 @@ class indirect_iterator indirect_iterator(); indirect_iterator(Iterator x); template < - class Iterator2, class Value2, class Category2 + class Iterator2, class Value2, unsigned Access2, class Traversal2 , class Reference2, class Difference2 > indirect_iterator( indirect_iterator< - Iterator2, Value2, Category2, Reference2, Difference2 + Iterator2, Value2, Access2, Traversal2, Reference2, Difference2 > const& y , typename enable_if_convertible<Iterator2, Iterator>::type* = 0 // exposition ); @@ -1408,9 +1419,10 @@ specialization of iterator_traits iterator.The Reference parameter will be the reference type of the indirect_iterator. The default is Value&.
-The Category parameter is the iterator_category type for the -indirect_iterator. The default is -iterator_traits<Iterator>::iterator_category.
+The Access and Traversal parameters are passed unchanged to +the corresponding parameters of the iterator_adaptor base +class, and the Iterator parameter is passed unchanged as the +Base parameter to the iterator_adaptor base class.
The indirect iterator will model the most refined standard traversal concept that is modeled by the Iterator type. The indirect iterator will model the most refined standard access concept that is @@ -1442,12 +1454,12 @@ the iterator_adaptor subobject
template < - class Iterator2, class Value2, class Category2 + class Iterator2, class Value2, unsigned Access, class Traversal , class Reference2, class Difference2 > indirect_iterator( indirect_iterator< - Iterator2, Value2, Category2, Reference2, Difference2 + Iterator2, Value2, Access, Traversal, Reference2, Difference2 > const& y , typename enable_if_convertible<Iterator2, Iterator>::type* = 0 // exposition ); @@ -1733,12 +1745,13 @@ class filter_iteratorfilter_iterator requirements
-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 most refined -standard access category that is modeled by Iterator.
+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 @@ -1830,13 +1843,19 @@ the base m_iterator, as per th
Class template counting_iterator
-template <class Incrementable, class Category = use_default, class Difference = use_default> +template < + class Incrementable + , unsigned Access = use_default_access + , class Traversal = use_default + , class Difference = use_default +> class counting_iterator : public iterator_adaptor< - counting_iterator<Incrementable, Category, Difference> + counting_iterator<Incrementable, Access, Traversal, Difference> , Incrementable , Incrementable - , /* see details for category */ + , Access + , /* see details for traversal category */ , Incrementable const& , Incrementable const* , /* distance = Difference or a signed integral type */> @@ -1935,7 +1954,7 @@ template <class UnaryFunction> class function_output_iterator { public: typedef iterator_tag< - writable_iterator_tag + writable_iterator , incrementable_traversal_tag > iterator_category; typedef void value_type; @@ -2043,7 +2062,7 @@ LocalWords: OtherIncrementable Coplien -->