diff --git a/development/libs/iterator/iterator_concepts.fig b/development/libs/iterator/iterator_concepts.fig
index 3c51b23..0723053 100644
--- a/development/libs/iterator/iterator_concepts.fig
+++ b/development/libs/iterator/iterator_concepts.fig
@@ -7,20 +7,16 @@ Letter
Single
-2
1200 2
-6 825 1575 3825 4500
+6 750 2100 3750 4125
2 1 0 1 0 7 100 0 -1 4.000 0 0 -1 1 0 2
1 1 1.00 60.00 120.00
- 1725 2400 1725 1800
+ 1650 3825 1650 3225
2 1 0 1 0 7 100 0 -1 4.000 0 0 -1 1 0 2
1 1 1.00 60.00 120.00
- 1725 4200 1725 3600
-2 1 0 1 0 7 100 0 -1 4.000 0 0 -1 1 0 2
- 1 1 1.00 60.00 120.00
- 1725 3300 1725 2700
-4 0 0 100 0 19 18 0.0000 4 255 2370 825 1800 SinglePassIterator\001
-4 0 0 100 0 19 18 0.0000 4 195 1995 825 2700 ForwardIterator\001
-4 0 0 100 0 19 18 0.0000 4 195 2565 825 3600 BidirectionalIterator\001
-4 0 0 100 0 19 18 0.0000 4 195 2955 825 4500 RandomAccessIterator\001
+ 1650 2925 1650 2325
+4 0 0 100 0 19 18 0.0000 4 210 1995 750 2325 ForwardIterator\001
+4 0 0 100 0 19 18 0.0000 4 210 2580 750 3225 BidirectionalIterator\001
+4 0 0 100 0 19 18 0.0000 4 210 2940 750 4125 RandomAccessIterator\001
-6
2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 1 0 2
1 1 1.00 60.00 120.00
@@ -31,7 +27,11 @@ Single
2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 1 0 2
1 1 1.00 60.00 120.00
6900 3000 7500 2400
-4 0 0 100 0 19 18 0.0000 4 195 1995 6600 2400 WritableIterator\001
-4 0 0 100 0 19 18 0.0000 4 195 2130 3900 2400 ReadableIterator\001
-4 0 0 50 0 19 18 0.0000 4 195 2805 5700 3300 MutableLvalueIterator\001
-4 0 0 50 0 19 18 0.0000 4 195 2955 3900 3900 ConstantLvalueIterator\001
+2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 1 0 2
+ 1 1 1.00 60.00 120.00
+ 6900 3000 9075 2475
+4 0 0 100 0 19 18 0.0000 4 210 2040 6600 2400 WritableIterator\001
+4 0 0 100 0 19 18 0.0000 4 210 2145 3900 2400 ReadableIterator\001
+4 0 0 50 0 19 18 0.0000 4 210 2835 5700 3300 MutableLvalueIterator\001
+4 0 0 50 0 19 18 0.0000 4 210 2970 3900 3900 ConstantLvalueIterator\001
+4 0 0 50 0 19 18 0.0000 4 270 2355 9075 2400 SwappableIterator\001
diff --git a/development/libs/iterator/iterator_concepts.gif b/development/libs/iterator/iterator_concepts.gif
index 762c055..29c38c9 100644
Binary files a/development/libs/iterator/iterator_concepts.gif and b/development/libs/iterator/iterator_concepts.gif differ
diff --git a/development/libs/iterator/iterator_concepts.htm b/development/libs/iterator/iterator_concepts.htm
index 0848ab5..f2f8dcd 100644
--- a/development/libs/iterator/iterator_concepts.htm
+++ b/development/libs/iterator/iterator_concepts.htm
@@ -43,53 +43,68 @@
+
The standard iterator concepts (the iterator requirements defined -in the C++ Standard) have a flaw. They glom together two separate -issues into a single set of concepts. The two issues are iterator -traversal and dereference return type semantics. These two issues are -inherently orthogonal and therefore ought to be represented by two -separate sets of concepts. The concepts described here do just -that.
+The standard iterator categories and requirements are flawed because +they use a single hierarchy of requirements to address two orthogonal +issues: iterator traversal and dereference return +type. The current iterator requirement hierarchy is mainly +geared towards iterator traversal (hence the category names), while +requirements that address dereference return type sneak in at various +places. +
+The iterator requirements should be separated into two hierarchies. One set of concepts handles the return type semantics:
+Note: we considered defining a Single-Pass Iterator, which could be +combined with Readable or Writable Iterator to replace the Input and +Output Iterator requirements. We rejected this idea because there are +some differences between Input and Output Iterators that make it hard +to merge them: for example Input Iterator requires Equality Comparable +while Output Iterator does not. + +
+-std::Input Iterator refines boost::Single-Pass Iterator and -boost::ReadableIterator. +std::Input Iterator implies boost::ReadableIterator.
-std::Output Iterator refines boost::Single-Pass Iterator and -boost::Writable Iterator. +std::Output Iterator implies boost::Writable Iterator.
std::Forward Iterator refines boost::Forward Iterator and @@ -106,106 +121,99 @@ boost::Constant Lvalue Iterator or boost::Mutable Lvalue Iterator.
X | -The iterator type. | -
T | -The value type of X. | -
x, y | -An object of type X. | -
t | -An object of type T. | +
X | +The iterator type. | +
T | +The value type of X, i.e., std::iterator_traits<X>::value_type. | +
x, y | +An object of type X. | +
t | +An object of type T. |
- template <class Readable Iterator> - void foo(Readable Iterator x) - { - typedef std::iterator_traits<Readable Iterator>::value_type T; - T t = *x; // Read a value. This is OK. - T& s = *x; // Bind to a reference. This is a bad idea. - *x = t; // Try to assign. This is a really bad idea. - } -- +iterator.
Value type | -boost::iterator_traits<X>::value_type | -- The type of the value obtained by dereferencing a LvalueIterator - | +
Value type | +std::iterator_traits<X>::value_type | +The type of the objects pointed to by the iterator. |
Return Category | -boost::iterator_traits<X>::return_category | -- A type convertible to boost::readable_iterator_tag - | +
Reference type | +std::iterator_traits<X>::reference | ++ The return type of dereferencing the iterator. This + type must be convertible to T. + | +
Return Category | +std::return_category<X>::type | ++ A type convertible to std::readable_iterator_tag + |
Name | Expression | Type requirements | Return type |
---|---|---|---|
Dereference | -*x | -- | Convertible to T. | -
Member access | -x->m | -T is a type with a member named m. | -- - | +
Name | Expression | Type requirements | Return type |
Dereference | +*x | ++ | std::iterator_traits<X>::reference | +
Member access | +x->m | +T is a type with a member named m. | ++If m is a data member, the type of m. +If m is a member function, the return type of m. + |
Return Category | -boost::iterator_traits<X>::return_category | -- A type convertible to boost::writable_iterator_tag - | +
Return Category | +std::return_category<X>::type | ++ A type convertible to std::writable_iterator_tag + |
Name | Expression | Return type | -
---|---|---|
Dereference assignment | -*x = a | -unspecified | -
Dereference assignment | +*x = a | +unspecified | +
-
+Note: the requirements for Swappable Iterator are dependent on the +issues surrounding std::swap() being resolved. Here we assume +that the issue will be resolved by allowing the overload of +std::swap() for user-defined types. + +
+Note: Readable Iterator and Writable Iterator combined implies +Swappable Iterator because of the fully templated +std::swap(). However, Swappable Iterator does not imply +Readable Iterator nor Writable Iterator. + +
Return Category | +std::return_category<X>::type | ++ A type convertible to std::swappable_iterator_tag + | +
+
Name | Expression | Return type | +
---|---|---|
Iterator Swap | +std::iter_swap(x, y) | +void | +
Dereference and Swap | +std::swap(*x, *y) | +void | +
+ + +
Value type | -boost::iterator_traits<X>::value_type | -- The type of the value obtained by dereferencing a Constant Lvalue Iterator. - | -
Reference type | -boost::iterator_traits<X>::reference | -- The return type of operator*(), which must be + |
Reference type | +std::iterator_traits<X>::reference | ++ The return type of dereferencing the iterator, which must be const T&. - | +
POinter type | -boost::iterator_traits<X>::pointer | -+ - |
Return Category | -boost::iterator_traits<X>::return_category | -- A type convertible to boost::constant_lvalue_iterator_tag - | +
Return Category | +std::return_category<X>::type | ++ A type convertible to std::constant_lvalue_iterator_tag + |
+ +
Value type | -boost::iterator_traits<X>::value_type | -- The type of the value obtained by dereferencing a Mutable Lvalue Iterator. - | +
Reference type | +std::iterator_traits<X>::reference | +The return type of dereferencing the iterator, which must be + T&. |
Reference type | -boost::iterator_traits<X>::reference | -- The return type of operator*(), which is - T&. - | -
Pointer type | -boost::iterator_traits<X>::pointer | -+ - |
Return Category | -boost::iterator_traits<X>::return_category | -- A type convertible to boost::mutable_lvalue_iterator_tag - | +
Return Category | +std::return_category<X>::type | ++ A type convertible to std::mutable_lvalue_iterator_tag + |
Difference type | -boost::iterator_traits<X>::difference_type | -- A signed integral type used to represent the distance from one - iterator to another, or the number of elements in a range. - | -
Traversal Category | -boost::iterator_traits<X>::traversal_category | -- A type convertible to boost::single_pass_iterator_tag - | +
Difference Type | +std::iterator_traits<X>::difference_type | ++ A signed integral type used for representing distances + between iterators that point into the same range. + |
Name | Expression | Type requirements | Return type | -
---|---|---|---|
Preincrement | -++i | X& | -|
Postincrement | -(void)i++ | - |
-
Traversal Category | -boost::iterator_traits<X>::traversal_category | -- A type convertible to boost::forward_iterator_tag - | +|
Preincrement | +++i | X& | +|
Postincrement | +i++ | convertible to const X& |
Traversal Category | -boost::iterator_traits<X>::traversal_category | -- A type convertible to boost::bidirectional_iterator_tag - | +
Traversal Category | +std::traversal_category<X>::type | ++ A type convertible to std::bidirectional_traversal_tag + |
Name | Expression | Type requirements | Return type | -
---|---|---|---|
Predecrement | ---i | X& | -|
Postdecrement | -i-- | X | +|
Predecrement | +--i | X& | +|
Postdecrement | +i-- | convertible to const X& |
Traversal Category | -boost::iterator_traits<X>::traversal_category | -- A type convertible to boost::random_access_iterator_tag - | +
Traversal Category | +std::traversal_category<X>::type | ++ A type convertible to std::random_access_traversal_tag + |
Name | Expression | Type requirements | +|
---|---|---|---|
Name | Expression | Type requirements | Return type | -
Iterator addition | -i += n | X& | -|
Iterator addition | -i + n or n + i | X | -|
Iterator subtraction | -i -= n | X& | -|
Iterator subtraction | -i - n | X | -|
Difference | -i - j | boost::iterator_traits<X>::difference_type | -|
Element operator | -i[n] | -X must be a model of - Readable Iterator. | -The same return type as *i. | -
Element assignment | -i[n] = t | -X must be a model of - Writable Iterator. | -unspecified | +
Iterator addition | +i += n | X& | +|
Iterator addition | +i + n or n + i | X | +|
Iterator subtraction | +i -= n | X& | +|
Iterator subtraction | +i - n | X | +|
Difference | +i - j | std::iterator_traits<X>::difference_type | +|
Element operator | +i[n] | +X must also be a model of + Readable Iterator. | +std::iterator_traits<X>::reference | +
Element assignment | +i[n] = t | +X must also be a model of + Writable Iterator. | +unspecified |