SlideShare a Scribd company logo
1 of 11
Download to read offline
New Iterator Concepts


Author:           David Abrahams, Jeremy Siek, Thomas Witt
Contact:          dave@boost-consulting.com, jsiek@osl.iu.edu, witt@styleadvisor.com
Organization:     Boost Consulting, Indiana University Open Systems Lab, Zephyr Asso-
                  ciates, Inc.
Date:             2004-11-01
Number:           This is a revised version of n1550=03-0133, which was accepted for Tech-
                  nical Report 1 by the C++ standard committeeā€™s library working group.
                  This proposal is a revision of paper n1297, n1477, and n1531.
Copyright:        Copyright David Abrahams, Jeremy Siek, and Thomas Witt 2003.

Abstract: We propose a new system of iterator concepts that treat access and positioning
    independently. This allows the concepts to more closely match the requirements of
    algorithms and provides better categorizations of iterators that are used in practice.


                                   Table of Contents
Motivation

Impact on the Standard

    Possible (but not proposed) Changes to the Working Paper
         Changes to Algorithm Requirements
         Deprecations
         vector<bool>

Design

Proposed Text

    Addition to [lib.iterator.requirements]
         Iterator Value Access Concepts [lib.iterator.value.access]
             Readable Iterators [lib.readable.iterators]
             Writable Iterators [lib.writable.iterators]
             Swappable Iterators [lib.swappable.iterators]
             Lvalue Iterators [lib.lvalue.iterators]
         Iterator Traversal Concepts [lib.iterator.traversal]
             Incrementable Iterators [lib.incrementable.iterators]
             Single Pass Iterators [lib.single.pass.iterators]
             Forward Traversal Iterators [lib.forward.traversal.iterators]
             Bidirectional Traversal Iterators [lib.bidirectional.traversal.iterators]
             Random Access Traversal Iterators [lib.random.access.traversal.iterators]
             Interoperable Iterators [lib.interoperable.iterators]




                                              1
Addition to [lib.iterator.synopsis]
           Addition to [lib.iterator.traits]

     Footnotes



Motivation
The standard iterator categories and requirements are ļ¬‚awed because they use a single hierarchy of
concepts to address two orthogonal issues: iterator traversal and value access. As a result, many
algorithms with requirements expressed in terms of the iterator categories are too strict. Also, many
real-world iterators can not be accurately categorized. A proxy-based iterator with random-access
traversal, for example, may only legally have a category of ā€œinput iteratorā€, so generic algorithms are
unable to take advantage of its random-access capabilities. The current iterator concept hierarchy is
geared towards iterator traversal (hence the category names), while requirements that address value
access sneak in at various places. The following table gives a summary of the current value access
requirements in the iterator categories.

                 Value Access Requirements in Existing Iterator Categories
  Output Iterator               *i = a
  Input Iterator                *i is convertible to T
  Forward Iterator              *i is T& (or const T& once issue 200 is resolved)
  Random Access Iterator        i[n] is convertible to T (also i[n] = t is required for mutable
                                iterators once issue 299 is resolved)

    Because iterator traversal and value access are mixed together in a single hierarchy, many useful
iterators can not be appropriately categorized. For example, vector<bool>::iterator is almost a
random access iterator, but the return type is not bool& (see issue 96 and Herb Sutterā€™s paper J16/99-
0008 = WG21 N1185). Therefore, the iterators of vector<bool> only meet the requirements of input
iterator and output iterator. This is so nonintuitive that the C++ standard contradicts itself on this
point. In paragraph 23.2.4/1 it says that a vector is a sequence that supports random access iterators.
    Another diļ¬ƒcult-to-categorize iterator is the transform iterator, an adaptor which applies a unary
function object to the dereferenced value of the some underlying iterator (see transform iterator). For
unary functions such as times, the return type of operator* clearly needs to be the result_type of
the function object, which is typically not a reference. Because random access iterators are required to
return lvalues from operator*, if you wrap int* with a transform iterator, you do not get a random
access iterator as might be expected, but an input iterator.
    A third example is found in the vertex and edge iterators of the Boost Graph Library. These iterators
return vertex and edge descriptors, which are lightweight handles created on-the-ļ¬‚y. They must be
returned by-value. As a result, their current standard iterator category is input_iterator_tag, which
means that, strictly speaking, you could not use these iterators with algorithms like min_element().
As a temporary solution, the concept Multi-Pass Input Iterator was introduced to describe the vertex
and edge descriptors, but as the design notes for the concept suggest, a better solution is needed.
    In short, there are many useful iterators that do not ļ¬t into the current standard iterator categories.
As a result, the following bad things happen:

   ā€¢ Iterators are often mis-categorized.

   ā€¢ Algorithm requirements are more strict than necessary, because they cannot separate the need for
     random access or bidirectional traversal from the need for a true reference return type.




                                                    2
Impact on the Standard
This proposal for TR1 is a pure extension. Further, the new iterator concepts are backward-compatible
with the old iterator requirements, and old iterators are forward-compatible with the new iterator
concepts. That is to say, iterators that satisfy the old requirements also satisfy appropriate concepts in
the new system, and iterators modeling the new concepts will automatically satisfy the appropriate old
requirements.

Possible (but not proposed) Changes to the Working Paper
The extensions in this paper suggest several changes we might make to the working paper for the next
standard. These changes are not a formal part of this proposal for TR1.

Changes to Algorithm Requirements
The algorithms in the standard library could beneļ¬t from the new iterator concepts because the new
concepts provide a more accurate way to express their type requirements. The result is algorithms that
are usable in more situations and have fewer type requirements.
    For the next working paper (but not for TR1), the committee should consider the following changes
to the type requirements of algorithms. These changes are phrased as textual substitutions, listing the
algorithms to which each textual substitution applies.
    Forward Iterator -> Forward Traversal Iterator and Readable Iterator
     find_end, adjacent_find, search, search_n, rotate_copy, lower_bound, upper_bound,
     equal_range, binary_search, min_element, max_element
   Forward Iterator (1) -> Single Pass Iterator and Readable Iterator, Forward Iterator (2) -> Forward
Traversal Iterator and Readable Iterator
     find_first_of
   Forward Iterator -> Readable Iterator and Writable Iterator
     iter_swap
   Forward Iterator -> Single Pass Iterator and Writable Iterator
     fill, generate
   Forward Iterator -> Forward Traversal Iterator and Swappable Iterator
     rotate
   Forward Iterator (1) -> Swappable Iterator and Single Pass Iterator, Forward Iterator (2) -> Swap-
pable Iterator and Incrementable Iterator
     swap_ranges

Forward Iterator -> Forward Traversal Iterator and Readable Iterator and Writable Iterator
    remove, remove_if, unique

   Forward Iterator -> Single Pass Iterator and Readable Iterator and Writable Iterator
     replace, replace_if

Bidirectional Iterator -> Bidirectional Traversal Iterator and Swappable Iterator reverse
Bidirectional Iterator -> Bidirectional Traversal Iterator and Readable and Swappable Iterator
     partition



                                                    3
Bidirectional Iterator (1) -> Bidirectional Traversal Iterator and Readable Iterator, Bidirectional
Iterator (2) -> Bidirectional Traversal Iterator and Writable Iterator
     copy_backwards

Bidirectional Iterator -> Bidirectional Traversal Iterator and Swappable Iterator and Readable Iterator
     next_permutation, prev_permutation
Bidirectional Iterator -> Bidirectional Traversal Iterator and Readable Iterator and Writable Iterator
     stable_partition, inplace_merge
Bidirectional Iterator -> Bidirectional Traversal Iterator and Readable Iterator reverse_copy
Random Access Iterator -> Random Access Traversal Iterator and Readable and Writable Iterator
    random_shuffle, sort, stable_sort, partial_sort, nth_element, push_heap, pop_heap
    make_heap, sort_heap
Input Iterator (2) -> Incrementable Iterator and Readable Iterator equal, mismatch
Input Iterator (2) -> Incrementable Iterator and Readable Iterator transform


Deprecations
For the next working paper (but not for TR1), the committee should consider deprecating the old
iterator tags, and std::iterator traits, since it will be superceded by individual traits metafunctions.

vector<bool>
For the next working paper (but not for TR1), the committee should consider reclassifying vec-
tor<bool>::iterator as a Random Access Traversal Iterator and Readable Iterator and Writable
Iterator.


Design
The iterator requirements are to be separated into two groups. One set of concepts handles the syntax
and semantics of value access:
   ā€¢ Readable Iterator
   ā€¢ Writable Iterator
   ā€¢ Swappable Iterator
   ā€¢ Lvalue Iterator
   The access concepts describe requirements related to operator* and operator->, including the
value_type, reference, and pointer associated types.
   The other set of concepts handles traversal:
   ā€¢ Incrementable Iterator
   ā€¢ Single Pass Iterator
   ā€¢ Forward Traversal Iterator
   ā€¢ Bidirectional Traversal Iterator
   ā€¢ Random Access Traversal Iterator



                                                   4
The reļ¬nement relationships for the traversal concepts are in the following diagram.




    In addition to the iterator movement operators, such as operator++, the traversal concepts also
include requirements on position comparison such as operator== and operator<. The reason for the
ļ¬ne grain slicing of the concepts into the Incrementable and Single Pass is to provide concepts that are
exact matches with the original input and output iterator requirements.
    This proposal also includes a concept for specifying when an iterator is interoperable with another
iterator, in the sense that int* is interoperable with int const*.

   ā€¢ Interoperable Iterators

   The relationship between the new iterator concepts and the old are given in the following diagram.




   Like the old iterator requirements, we provide tags for purposes of dispatching based on the traversal
concepts. The tags are related via inheritance so that a tag is convertible to another tag if the concept
associated with the ļ¬rst tag is a reļ¬nement of the second tag.
   Our design reuses iterator_traits<Iter>::iterator_category to indicate an iteratorā€™s traversal
capability. To specify capabilities not captured by any old-style iterator category, an iterator designer
can use an iterator_category type that is convertible to both the the most-derived old iterator



                                                   5
category tag which ļ¬ts, and the appropriate new iterator traversal tag.
    We do not provide tags for the purposes of dispatching based on the access concepts, in part because
we could not ļ¬nd a way to automatically infer the right access tags for old-style iterators. An iteratorā€™s
writability may be dependent on the assignability of its value_type and thereā€™s no known way to detect
whether an arbitrary type is assignable. Fortunately, the need for dispatching based on access capability
is not as great as the need for dispatching based on traversal capability.
    A diļ¬ƒcult design decision concerned the operator[]. The direct approach for specifying operator[]
would have a return type of reference; the same as operator*. However, going in this direction would
mean that an iterator satisfying the old Random Access Iterator requirements would not necessarily be
a model of Readable or Writable Lvalue Iterator. Instead we have chosen a design that matches the
preferred resolution of issue 299: operator[] is only required to return something convertible to the
value_type (for a Readable Iterator), and is required to support assignment i[n] = t (for a Writable
Iterator).


Proposed Text
Addition to [lib.iterator.requirements]
Iterator Value Access Concepts [lib.iterator.value.access]
In the tables below, X is an iterator type, a is a constant object of type X, R is std::iterator_traits<X>::reference,
T is std::iterator_traits<X>::value_type, and v is a constant object of type T.

Readable Iterators [lib.readable.iterators]
A class or built-in type X models the Readable Iterator concept for value type T if, in addition to X
being Assignable and Copy Constructible, the following expressions are valid and respect the stated
semantics. U is the type of any speciļ¬ed member of type T.

  Readable Iterator Requirements (in addition to Assignable and Copy Constructible)
  Expression               Return Type        Note/Precondition
 iterator_traits<X>::value_type
                          T                  Any non-reference, non-cv-qualiļ¬ed type

 *a                              Convertible to T       pre: a is dereferenceable. If a == b then *a
                                                              is equivalent to *b.
 a->m                            U&                     pre: pre: (*a).m is well-deļ¬ned. Equivalent to
                                                        (*a).m.



Writable Iterators [lib.writable.iterators]
A class or built-in type X models the Writable Iterator concept if, in addition to X being Copy Con-
structible, the following expressions are valid and respect the stated semantics. Writable Iterators have
an associated set of value types.

       Writable Iterator Requirements (in addition to Copy Constructible)
       Expression                  Return Type         Precondition
      *a = o                                          pre: The type of o is in the set of
                                                      value types of X




                                                    6
Swappable Iterators [lib.swappable.iterators]
A class or built-in type X models the Swappable Iterator concept if, in addition to X being Copy Con-
structible, the following expressions are valid and respect the stated semantics.

       Swappable Iterator Requirements (in addition to Copy Constructible)
       Expression                  Return Type       Postcondition
      iter_swap(a, b)             void              the pointed to values are exchanged

  [Note: An iterator that is a model of the Readable Iterator and Writable Iterator concepts is also a
model of Swappable Iterator. --end note]

Lvalue Iterators [lib.lvalue.iterators]
The Lvalue Iterator concept adds the requirement that the return type of operator* type be a reference
to the value type of the iterator.

            Lvalue Iterator Requirements
            Expression            Return           Note/Assertion
                             Type
           *a                T&                   T is cv iterator_traits<X>::value_type
                                                  where cv is an optional cv-qualiļ¬cation.
                                                  pre: a is dereferenceable.

    If X is a Writable Iterator then a == b if and only if *a is the same object as *b. If X is a Readable
Iterator then a == b implies *a is the same object as *b.

Iterator Traversal Concepts [lib.iterator.traversal]
In the tables below, X is an iterator type, a and b are constant objects of type X, r and s are mutable
objects of type X, T is std::iterator_traits<X>::value_type, and v is a constant object of type T.

Incrementable Iterators [lib.incrementable.iterators]
A class or built-in type X models the Incrementable Iterator concept if, in addition to X being Assignable
and Copy Constructible, the following expressions are valid and respect the stated semantics.

  Incrementable Iterator Requirements (in addition to Assignable, Copy Constructible)
  Expression                       Return Type                        Assertion
 ++r                              X&                                 &r == &++r
 r++
 *r++
 iterator_traversal<X>::type      Convertible       to      incre-
                                  mentable_traversal_tag
    If X is a Writable Iterator then X a(r++); is equivalent to X a(r); ++r; and *r++ = o is equivalent
to *r = o; ++r. If X is a Readable Iterator then T z(*r++); is equivalent to T z(*r); ++r;.
Single Pass Iterators [lib.single.pass.iterators]
A class or built-in type X models the Single Pass Iterator concept if the following expressions are valid
and respect the stated semantics.




                                                    7
Single Pass Iterator Requirements (in addition to Incrementable Iterator and Equality Comparable)
  Expression                      Return Type                   Oper-      Assertion/       Pre-
                                                           ational     /Post-condition
                                                           Semantics
 ++r                             X&                                    pre: r is dereferenceable;
                                                                       post: r is dereference-
                                                                       able or r is past-the-end
 a == b                          convertible to bool                   == is an equivalence rela-
                                                                       tion over its domain
 a != b                          convertible to bool       !(a == b)
                                 A signed integral type
 iterator_traits<X>::difference_type
                                 representing the distance
                                 between iterators
 iterator_traversal<X>::type     Convertible     to   sin-
                                 gle_pass_traversal_tag

Forward Traversal Iterators [lib.forward.traversal.iterators]
A class or built-in type X models the Forward Traversal Iterator concept if, in addition to X meeting
the requirements of Default Constructible and Single Pass Iterator, the following expressions are valid
and respect the stated semantics.

  Forward Traversal Iterator Requirements (in addition to Default Constructible and Single Pass Iterat
  Expression                       Return Type                    Assertion/Note
 X u;                             X&                             note: u may have a singu-
                                                                 lar value.
 ++r                              X&                             r == s and r is deref-
                                                                 erenceable implies ++r ==
                                                                 ++s.
 iterator_traversal<X>::type      Convertible     to      for-
                                  ward_traversal_tag
Bidirectional Traversal Iterators [lib.bidirectional.traversal.iterators]
A class or built-in type X models the Bidirectional Traversal Iterator concept if, in addition to X meeting
the requirements of Forward Traversal Iterator, the following expressions are valid and respect the stated
semantics.

  Bidirectional Traversal Iterator Requirements (in addition to Forward Traversal Iterator)
  Expression                     Return Type                 Operational    Assertion/ Pre-
                                                            Semantics     /Post-condition
 --r                            X&                                        pre: there exists s
                                                                          such that r == ++s.
                                                                          post: s is dereference-
                                                                          able.
                                                                          ++(--r) == r. --r
                                                                          == --s implies r ==
                                                                          s. &r == &--r.
 r--                            convertible to const X&     {
                                                              X tmp = r;
                                                              --r;
                                                              re-
                                                            turn tmp;
                                                            }



                                                    8
Bidirectional Traversal Iterator Requirements (in addition to Forward Traversal Iterator)
  Expression                     Return Type                 Operational    Assertion/ Pre-
                                                            Semantics     /Post-condition
 iterator_traversal<X>::type Convertible     to   bidirec-
                                tional_traversal_tag
Random Access Traversal Iterators [lib.random.access.traversal.iterators]
A class or built-in type X models the Random Access Traversal Iterator concept if the following
expressions are valid and respect the stated semantics. In the table below, Distance is itera-
tor_traits<X>::difference_type and n represents a constant object of type Distance.

  Random Access Traversal Iterator Requirements (in addition to Bidirectional Traversal Iterator)
  Expression               Return Type               Operational Se-       Assertion/ Pre-
                                                   mantics                condition
 r += n                   X&                       {
                                                     Distance m = n;
                                                     if (m >= 0)
                                                       while (m--)
                                                         ++r;
                                                     else
                                                       while (m++)
                                                         --r;
                                                     return r;
                                                   }
 a + n, n + a             X                        { X tmp = a; re-
                                                   turn tmp += n;
                                                   }
 r -= n                   X&                       return r += -n
 a - n                    X                        { X tmp = a; re-
                                                   turn tmp -= n;
                                                   }
 b - a                    Distance                 a < b ? dis-           pre: there exists a
                                                   tance(a,b) : -         value n of Distance
                                                   distance(b,a)          such that a + n ==
                                                                          b. b == a + (b -
                                                                          a).
 a[n]                     convertible to T         *(a + n)               pre: a is a Readable
                                                                          Iterator
 a[n] = v                 convertible to T         *(a + n) = v           pre: a is a Writable
                                                                          Iterator
 a < b                    convertible to bool      b - a > 0              < is a total ordering
                                                                          relation
 a > b                    convertible to bool      b < a                  > is a total ordering
                                                                          relation
 a >= b                   convertible to bool      !(a < b)
 a <= b                   convertible to bool      !(a > b)
                          Convertible
 iterator_traversal<X>::type               to ran-
                          dom_access_traversal_tag




                                              9
Interoperable Iterators [lib.interoperable.iterators]
A class or built-in type X that models Single Pass Iterator is interoperable with a class or built-in
type Y that also models Single Pass Iterator if the following expressions are valid and respect the
stated semantics. In the tables below, x is an object of type X, y is an object of type Y, Distance is
iterator_traits<Y>::difference_type, and n represents a constant object of type Distance.

      Expres-     Return Type                  Assertion/Precondition/Postcondition
 sion
 y = x           Y                            post: y == x
 Y(x)            Y                            post: Y(x) == x
 x == y          convertible   to   bool      == is an equivalence relation over its domain.
 y == x          convertible   to   bool      == is an equivalence relation over its domain.
 x != y          convertible   to   bool      bool(a==b) != bool(a!=b) over its domain.
 y != x          convertible   to   bool      bool(a==b) != bool(a!=b) over its domain.

  If X and Y both model Random Access Traversal Iterator then the following additional requirements
must be met.

    Expres-      Return Type                 Operational Se-         Assertion/ Precondition
 sion                                      mantics
 x < y          convertible   to   bool    y - x > 0                 <   is   a   total   ordering   relation
 y < x          convertible   to   bool    x - y > 0                 <   is   a   total   ordering   relation
 x > y          convertible   to   bool    y < x                     >   is   a   total   ordering   relation
 y > x          convertible   to   bool    x < y                     >   is   a   total   ordering   relation
 x >= y         convertible   to   bool    !(x < y)
 y >= x         convertible   to   bool    !(y < x)
 x <= y         convertible   to   bool    !(x > y)
 y <= x         convertible   to   bool    !(y > x)
 y - x          Distance                   distance(Y(x),y)          pre: there exists         a value n of Distance
                                                                     such that x + n           == y. y == x + (y -
                                                                     x).
 x - y          Distance                   distance(y,Y(x))          pre: there exists         a value n of Distance
                                                                     such that y + n           == x. x == y + (x -
                                                                     y).



Addition to [lib.iterator.synopsis]
     // lib.iterator.traits, traits and tags
     template <class Iterator> struct is_readable_iterator;
     template <class Iterator> struct iterator_traversal;

     struct   incrementable_traversal_tag { };
     struct   single_pass_traversal_tag : incrementable_traversal_tag { };
     struct   forward_traversal_tag : single_pass_traversal_tag { };
     struct   bidirectional_traversal_tag : forward_traversal_tag { };
     struct   random_access_traversal_tag : bidirectional_traversal_tag { };


Addition to [lib.iterator.traits]
The is_readable_iterator class template satisļ¬es the UnaryTypeTrait requirements.



                                                 10
Given an iterator type X, is_readable_iterator<X>::value yields true if, for an object a of type
X, *a is convertible to iterator_traits<X>::value_type, and false otherwise.
    iterator_traversal<X>::type is

     category-to-traversal (iterator_traits<X>::iterator_category)

   where category-to-traversal is deļ¬ned as follows

     category-to-traversal (C) =
         if (C is convertible to incrementable_traversal_tag)
             return C;
         else if (C is convertible to random_access_iterator_tag)
             return random_access_traversal_tag;
         else if (C is convertible to bidirectional_iterator_tag)
             return bidirectional_traversal_tag;
         else if (C is convertible to forward_iterator_tag)
             return forward_traversal_tag;
         else if (C is convertible to input_iterator_tag)
             return single_pass_traversal_tag;
         else if (C is convertible to output_iterator_tag)
             return incrementable_traversal_tag;
         else
             the program is ill-formed



Footnotes
The UnaryTypeTrait concept is deļ¬ned in n1519; the LWG is considering adding the requirement that
specializations are derived from their nested ::type.




                                                  11

More Related Content

What's hot

Ap Power Point Chpt2
Ap Power Point Chpt2Ap Power Point Chpt2
Ap Power Point Chpt2dplunkett
Ā 
SQL Interview Questions For Experienced
SQL Interview Questions For ExperiencedSQL Interview Questions For Experienced
SQL Interview Questions For Experiencedzynofustechnology
Ā 
Ap Power Point Chpt6
Ap Power Point Chpt6Ap Power Point Chpt6
Ap Power Point Chpt6dplunkett
Ā 
Sdtl manual
Sdtl manualSdtl manual
Sdtl manualqaz8989
Ā 
Wrapper class (130240116056)
Wrapper class (130240116056)Wrapper class (130240116056)
Wrapper class (130240116056)Akshay soni
Ā 
String handling(string buffer class)
String handling(string buffer class)String handling(string buffer class)
String handling(string buffer class)Ravi Kant Sahu
Ā 
Ap Power Point Chpt3 B
Ap Power Point Chpt3 BAp Power Point Chpt3 B
Ap Power Point Chpt3 Bdplunkett
Ā 
Lecture 4 classes ii
Lecture 4 classes iiLecture 4 classes ii
Lecture 4 classes iithe_wumberlog
Ā 
wrapper classes
wrapper classeswrapper classes
wrapper classesRajesh Roky
Ā 
L9 wrapper classes
L9 wrapper classesL9 wrapper classes
L9 wrapper classesteach4uin
Ā 
Expert system with python -2
Expert system with python  -2Expert system with python  -2
Expert system with python -2Ahmad Hussein
Ā 
Data Types & Variables in JAVA
Data Types & Variables in JAVAData Types & Variables in JAVA
Data Types & Variables in JAVAAnkita Totala
Ā 
Farhaan Ahmed, BCA 2nd Year
Farhaan Ahmed, BCA 2nd YearFarhaan Ahmed, BCA 2nd Year
Farhaan Ahmed, BCA 2nd Yeardezyneecole
Ā 
Python Interview Questions For Experienced
Python Interview Questions For ExperiencedPython Interview Questions For Experienced
Python Interview Questions For Experiencedzynofustechnology
Ā 

What's hot (19)

Ap Power Point Chpt2
Ap Power Point Chpt2Ap Power Point Chpt2
Ap Power Point Chpt2
Ā 
Md03 - part3
Md03 - part3Md03 - part3
Md03 - part3
Ā 
SQL Interview Questions For Experienced
SQL Interview Questions For ExperiencedSQL Interview Questions For Experienced
SQL Interview Questions For Experienced
Ā 
Ap Power Point Chpt6
Ap Power Point Chpt6Ap Power Point Chpt6
Ap Power Point Chpt6
Ā 
Sdtl manual
Sdtl manualSdtl manual
Sdtl manual
Ā 
Wrapper class (130240116056)
Wrapper class (130240116056)Wrapper class (130240116056)
Wrapper class (130240116056)
Ā 
String handling(string buffer class)
String handling(string buffer class)String handling(string buffer class)
String handling(string buffer class)
Ā 
Ap Power Point Chpt3 B
Ap Power Point Chpt3 BAp Power Point Chpt3 B
Ap Power Point Chpt3 B
Ā 
Datatype
DatatypeDatatype
Datatype
Ā 
Lecture 4 classes ii
Lecture 4 classes iiLecture 4 classes ii
Lecture 4 classes ii
Ā 
wrapper classes
wrapper classeswrapper classes
wrapper classes
Ā 
Oops
OopsOops
Oops
Ā 
L9 wrapper classes
L9 wrapper classesL9 wrapper classes
L9 wrapper classes
Ā 
Expert system with python -2
Expert system with python  -2Expert system with python  -2
Expert system with python -2
Ā 
Data Types & Variables in JAVA
Data Types & Variables in JAVAData Types & Variables in JAVA
Data Types & Variables in JAVA
Ā 
01 objective-c session 1
01  objective-c session 101  objective-c session 1
01 objective-c session 1
Ā 
Farhaan Ahmed, BCA 2nd Year
Farhaan Ahmed, BCA 2nd YearFarhaan Ahmed, BCA 2nd Year
Farhaan Ahmed, BCA 2nd Year
Ā 
Oop
OopOop
Oop
Ā 
Python Interview Questions For Experienced
Python Interview Questions For ExperiencedPython Interview Questions For Experienced
Python Interview Questions For Experienced
Ā 

Viewers also liked

2008_IRLbot
2008_IRLbot2008_IRLbot
2008_IRLbotHiroshi Ono
Ā 
Solving_the_C20K_problem_PHP_Performance_and_Scalability-phpquebec_2009
Solving_the_C20K_problem_PHP_Performance_and_Scalability-phpquebec_2009Solving_the_C20K_problem_PHP_Performance_and_Scalability-phpquebec_2009
Solving_the_C20K_problem_PHP_Performance_and_Scalability-phpquebec_2009Hiroshi Ono
Ā 
gfs-sosp2003
gfs-sosp2003gfs-sosp2003
gfs-sosp2003Hiroshi Ono
Ā 
Google_A_Behind_the_Scenes_Tour_-_Jeff_Dean
Google_A_Behind_the_Scenes_Tour_-_Jeff_DeanGoogle_A_Behind_the_Scenes_Tour_-_Jeff_Dean
Google_A_Behind_the_Scenes_Tour_-_Jeff_DeanHiroshi Ono
Ā 
Why Content Marketing Builds Trust
Why Content Marketing Builds TrustWhy Content Marketing Builds Trust
Why Content Marketing Builds Trustbpost
Ā 
The revolution has been cancelled: the current state of UK Open Access
The revolution has been cancelled:  the current state of UK Open AccessThe revolution has been cancelled:  the current state of UK Open Access
The revolution has been cancelled: the current state of UK Open AccessRepository Fringe
Ā 
Novel biologics for asthma
Novel biologics for asthmaNovel biologics for asthma
Novel biologics for asthmaYujia Sun
Ā 
Advanced Link Building Strategies for Affiliate Sites - Patrick Atloft
Advanced Link Building Strategies for Affiliate Sites - Patrick AtloftAdvanced Link Building Strategies for Affiliate Sites - Patrick Atloft
Advanced Link Building Strategies for Affiliate Sites - Patrick Atloftauexpo Conference
Ā 
Mobile Messaging - Part 5 - Mms Arch And Transactions
Mobile Messaging  - Part 5 - Mms Arch And TransactionsMobile Messaging  - Part 5 - Mms Arch And Transactions
Mobile Messaging - Part 5 - Mms Arch And TransactionsGwenaƫl Le Bodic
Ā 
How to Leverage Appium in Your Mobile App Testing
How to Leverage Appium in Your Mobile App TestingHow to Leverage Appium in Your Mobile App Testing
How to Leverage Appium in Your Mobile App TestingBitbar
Ā 
ćƒ‡ćƒ¼ć‚æćƒ»ćƒ†ć‚­ć‚¹ćƒˆćƒžć‚¤ćƒ‹ćƒ³ć‚°
ćƒ‡ćƒ¼ć‚æćƒ»ćƒ†ć‚­ć‚¹ćƒˆćƒžć‚¤ćƒ‹ćƒ³ć‚°ćƒ‡ćƒ¼ć‚æćƒ»ćƒ†ć‚­ć‚¹ćƒˆćƒžć‚¤ćƒ‹ćƒ³ć‚°
ćƒ‡ćƒ¼ć‚æćƒ»ćƒ†ć‚­ć‚¹ćƒˆćƒžć‚¤ćƒ‹ćƒ³ć‚°Hiroshi Ono
Ā 
downey08semaphores.pdf
downey08semaphores.pdfdowney08semaphores.pdf
downey08semaphores.pdfHiroshi Ono
Ā 
scalaliftoff2009.pdf
scalaliftoff2009.pdfscalaliftoff2009.pdf
scalaliftoff2009.pdfHiroshi Ono
Ā 
scalaliftoff2009.pdf
scalaliftoff2009.pdfscalaliftoff2009.pdf
scalaliftoff2009.pdfHiroshi Ono
Ā 
program_draft3.pdf
program_draft3.pdfprogram_draft3.pdf
program_draft3.pdfHiroshi Ono
Ā 
drop_acid_pycon_2009
drop_acid_pycon_2009drop_acid_pycon_2009
drop_acid_pycon_2009Hiroshi Ono
Ā 

Viewers also liked (20)

2008_IRLbot
2008_IRLbot2008_IRLbot
2008_IRLbot
Ā 
Solving_the_C20K_problem_PHP_Performance_and_Scalability-phpquebec_2009
Solving_the_C20K_problem_PHP_Performance_and_Scalability-phpquebec_2009Solving_the_C20K_problem_PHP_Performance_and_Scalability-phpquebec_2009
Solving_the_C20K_problem_PHP_Performance_and_Scalability-phpquebec_2009
Ā 
mmds
mmdsmmds
mmds
Ā 
gfs-sosp2003
gfs-sosp2003gfs-sosp2003
gfs-sosp2003
Ā 
Google_A_Behind_the_Scenes_Tour_-_Jeff_Dean
Google_A_Behind_the_Scenes_Tour_-_Jeff_DeanGoogle_A_Behind_the_Scenes_Tour_-_Jeff_Dean
Google_A_Behind_the_Scenes_Tour_-_Jeff_Dean
Ā 
Why Content Marketing Builds Trust
Why Content Marketing Builds TrustWhy Content Marketing Builds Trust
Why Content Marketing Builds Trust
Ā 
The revolution has been cancelled: the current state of UK Open Access
The revolution has been cancelled:  the current state of UK Open AccessThe revolution has been cancelled:  the current state of UK Open Access
The revolution has been cancelled: the current state of UK Open Access
Ā 
Novel biologics for asthma
Novel biologics for asthmaNovel biologics for asthma
Novel biologics for asthma
Ā 
Advanced Link Building Strategies for Affiliate Sites - Patrick Atloft
Advanced Link Building Strategies for Affiliate Sites - Patrick AtloftAdvanced Link Building Strategies for Affiliate Sites - Patrick Atloft
Advanced Link Building Strategies for Affiliate Sites - Patrick Atloft
Ā 
Mobile Messaging - Part 5 - Mms Arch And Transactions
Mobile Messaging  - Part 5 - Mms Arch And TransactionsMobile Messaging  - Part 5 - Mms Arch And Transactions
Mobile Messaging - Part 5 - Mms Arch And Transactions
Ā 
How to Leverage Appium in Your Mobile App Testing
How to Leverage Appium in Your Mobile App TestingHow to Leverage Appium in Your Mobile App Testing
How to Leverage Appium in Your Mobile App Testing
Ā 
ćƒ‡ćƒ¼ć‚æćƒ»ćƒ†ć‚­ć‚¹ćƒˆćƒžć‚¤ćƒ‹ćƒ³ć‚°
ćƒ‡ćƒ¼ć‚æćƒ»ćƒ†ć‚­ć‚¹ćƒˆćƒžć‚¤ćƒ‹ćƒ³ć‚°ćƒ‡ćƒ¼ć‚æćƒ»ćƒ†ć‚­ć‚¹ćƒˆćƒžć‚¤ćƒ‹ćƒ³ć‚°
ćƒ‡ćƒ¼ć‚æćƒ»ćƒ†ć‚­ć‚¹ćƒˆćƒžć‚¤ćƒ‹ćƒ³ć‚°
Ā 
cluster08
cluster08cluster08
cluster08
Ā 
I03
I03I03
I03
Ā 
sigmod08
sigmod08sigmod08
sigmod08
Ā 
downey08semaphores.pdf
downey08semaphores.pdfdowney08semaphores.pdf
downey08semaphores.pdf
Ā 
scalaliftoff2009.pdf
scalaliftoff2009.pdfscalaliftoff2009.pdf
scalaliftoff2009.pdf
Ā 
scalaliftoff2009.pdf
scalaliftoff2009.pdfscalaliftoff2009.pdf
scalaliftoff2009.pdf
Ā 
program_draft3.pdf
program_draft3.pdfprogram_draft3.pdf
program_draft3.pdf
Ā 
drop_acid_pycon_2009
drop_acid_pycon_2009drop_acid_pycon_2009
drop_acid_pycon_2009
Ā 

Similar to New Iterator Concepts Proposes Separating Access and Positioning

Iterator - a powerful but underappreciated design pattern
Iterator - a powerful but underappreciated design patternIterator - a powerful but underappreciated design pattern
Iterator - a powerful but underappreciated design patternNitin Bhide
Ā 
Introduction to new features in java 8
Introduction to new features in java 8Introduction to new features in java 8
Introduction to new features in java 8Raffi Khatchadourian
Ā 
Chapter 01 Introduction to Java by Tushar B Kute
Chapter 01 Introduction to Java by Tushar B KuteChapter 01 Introduction to Java by Tushar B Kute
Chapter 01 Introduction to Java by Tushar B KuteTushar B Kute
Ā 
Charles Sharp: Java 8 Streams
Charles Sharp: Java 8 StreamsCharles Sharp: Java 8 Streams
Charles Sharp: Java 8 Streamsjessitron
Ā 
Python_Unit_2.pdf
Python_Unit_2.pdfPython_Unit_2.pdf
Python_Unit_2.pdfalaparthi
Ā 
Fuel Up JavaScript with Functional Programming
Fuel Up JavaScript with Functional ProgrammingFuel Up JavaScript with Functional Programming
Fuel Up JavaScript with Functional ProgrammingShine Xavier
Ā 
C++ - Constructors,Destructors, Operator overloading and Type conversion
C++ - Constructors,Destructors, Operator overloading and Type conversionC++ - Constructors,Destructors, Operator overloading and Type conversion
C++ - Constructors,Destructors, Operator overloading and Type conversionHashni T
Ā 
Predictable reactive state management - ngrx
Predictable reactive state management - ngrxPredictable reactive state management - ngrx
Predictable reactive state management - ngrxIlia Idakiev
Ā 
Static abstract members nelle interfacce di C# 11 e dintorni di .NET 7.pptx
Static abstract members nelle interfacce di C# 11 e dintorni di .NET 7.pptxStatic abstract members nelle interfacce di C# 11 e dintorni di .NET 7.pptx
Static abstract members nelle interfacce di C# 11 e dintorni di .NET 7.pptxMarco Parenzan
Ā 
Presentation on overloading
Presentation on overloading Presentation on overloading
Presentation on overloading Charndeep Sekhon
Ā 
Unit3_OOP-converted.pdf
Unit3_OOP-converted.pdfUnit3_OOP-converted.pdf
Unit3_OOP-converted.pdfPowerfullBoy1
Ā 
Lec 28 - operator overloading
Lec 28 - operator overloadingLec 28 - operator overloading
Lec 28 - operator overloadingPrincess Sam
Ā 
Uml Omg Fundamental Certification 3
Uml Omg Fundamental Certification 3Uml Omg Fundamental Certification 3
Uml Omg Fundamental Certification 3Ricardo Quintero
Ā 
Chapter24
Chapter24Chapter24
Chapter24gourab87
Ā 
Userdefined functions brief explaination.pdf
Userdefined functions brief explaination.pdfUserdefined functions brief explaination.pdf
Userdefined functions brief explaination.pdfDeeptiMalhotra19
Ā 

Similar to New Iterator Concepts Proposes Separating Access and Positioning (20)

Iterator - a powerful but underappreciated design pattern
Iterator - a powerful but underappreciated design patternIterator - a powerful but underappreciated design pattern
Iterator - a powerful but underappreciated design pattern
Ā 
Polymorphism
PolymorphismPolymorphism
Polymorphism
Ā 
C Programming - Refresher - Part II
C Programming - Refresher - Part II C Programming - Refresher - Part II
C Programming - Refresher - Part II
Ā 
Sysprog 9
Sysprog 9Sysprog 9
Sysprog 9
Ā 
Introduction to new features in java 8
Introduction to new features in java 8Introduction to new features in java 8
Introduction to new features in java 8
Ā 
Introduction to new features in java 8
Introduction to new features in java 8Introduction to new features in java 8
Introduction to new features in java 8
Ā 
VB.net
VB.netVB.net
VB.net
Ā 
Chapter 01 Introduction to Java by Tushar B Kute
Chapter 01 Introduction to Java by Tushar B KuteChapter 01 Introduction to Java by Tushar B Kute
Chapter 01 Introduction to Java by Tushar B Kute
Ā 
Charles Sharp: Java 8 Streams
Charles Sharp: Java 8 StreamsCharles Sharp: Java 8 Streams
Charles Sharp: Java 8 Streams
Ā 
Python_Unit_2.pdf
Python_Unit_2.pdfPython_Unit_2.pdf
Python_Unit_2.pdf
Ā 
Fuel Up JavaScript with Functional Programming
Fuel Up JavaScript with Functional ProgrammingFuel Up JavaScript with Functional Programming
Fuel Up JavaScript with Functional Programming
Ā 
C++ - Constructors,Destructors, Operator overloading and Type conversion
C++ - Constructors,Destructors, Operator overloading and Type conversionC++ - Constructors,Destructors, Operator overloading and Type conversion
C++ - Constructors,Destructors, Operator overloading and Type conversion
Ā 
Predictable reactive state management - ngrx
Predictable reactive state management - ngrxPredictable reactive state management - ngrx
Predictable reactive state management - ngrx
Ā 
Static abstract members nelle interfacce di C# 11 e dintorni di .NET 7.pptx
Static abstract members nelle interfacce di C# 11 e dintorni di .NET 7.pptxStatic abstract members nelle interfacce di C# 11 e dintorni di .NET 7.pptx
Static abstract members nelle interfacce di C# 11 e dintorni di .NET 7.pptx
Ā 
Presentation on overloading
Presentation on overloading Presentation on overloading
Presentation on overloading
Ā 
Unit3_OOP-converted.pdf
Unit3_OOP-converted.pdfUnit3_OOP-converted.pdf
Unit3_OOP-converted.pdf
Ā 
Lec 28 - operator overloading
Lec 28 - operator overloadingLec 28 - operator overloading
Lec 28 - operator overloading
Ā 
Uml Omg Fundamental Certification 3
Uml Omg Fundamental Certification 3Uml Omg Fundamental Certification 3
Uml Omg Fundamental Certification 3
Ā 
Chapter24
Chapter24Chapter24
Chapter24
Ā 
Userdefined functions brief explaination.pdf
Userdefined functions brief explaination.pdfUserdefined functions brief explaination.pdf
Userdefined functions brief explaination.pdf
Ā 

More from Hiroshi Ono

Voltdb - wikipedia
Voltdb - wikipediaVoltdb - wikipedia
Voltdb - wikipediaHiroshi Ono
Ā 
GamecenterꦂčŖ¬
GamecenterꦂčŖ¬GamecenterꦂčŖ¬
GamecenterꦂčŖ¬Hiroshi Ono
Ā 
EventDrivenArchitecture
EventDrivenArchitectureEventDrivenArchitecture
EventDrivenArchitectureHiroshi Ono
Ā 
nodalities_issue7.pdf
nodalities_issue7.pdfnodalities_issue7.pdf
nodalities_issue7.pdfHiroshi Ono
Ā 
genpaxospublic-090703114743-phpapp01.pdf
genpaxospublic-090703114743-phpapp01.pdfgenpaxospublic-090703114743-phpapp01.pdf
genpaxospublic-090703114743-phpapp01.pdfHiroshi Ono
Ā 
kademlia-1227143905867010-8.pdf
kademlia-1227143905867010-8.pdfkademlia-1227143905867010-8.pdf
kademlia-1227143905867010-8.pdfHiroshi Ono
Ā 
pragmaticrealworldscalajfokus2009-1233251076441384-2.pdf
pragmaticrealworldscalajfokus2009-1233251076441384-2.pdfpragmaticrealworldscalajfokus2009-1233251076441384-2.pdf
pragmaticrealworldscalajfokus2009-1233251076441384-2.pdfHiroshi Ono
Ā 
downey08semaphores.pdf
downey08semaphores.pdfdowney08semaphores.pdf
downey08semaphores.pdfHiroshi Ono
Ā 
BOF1-Scala02.pdf
BOF1-Scala02.pdfBOF1-Scala02.pdf
BOF1-Scala02.pdfHiroshi Ono
Ā 
TwitterOct2008.pdf
TwitterOct2008.pdfTwitterOct2008.pdf
TwitterOct2008.pdfHiroshi Ono
Ā 
camel-scala.pdf
camel-scala.pdfcamel-scala.pdf
camel-scala.pdfHiroshi Ono
Ā 
stateyouredoingitwrongjavaone2009-090617031310-phpapp02.pdf
stateyouredoingitwrongjavaone2009-090617031310-phpapp02.pdfstateyouredoingitwrongjavaone2009-090617031310-phpapp02.pdf
stateyouredoingitwrongjavaone2009-090617031310-phpapp02.pdfHiroshi Ono
Ā 
SACSIS2009_TCP.pdf
SACSIS2009_TCP.pdfSACSIS2009_TCP.pdf
SACSIS2009_TCP.pdfHiroshi Ono
Ā 
stateyouredoingitwrongjavaone2009-090617031310-phpapp02.pdf
stateyouredoingitwrongjavaone2009-090617031310-phpapp02.pdfstateyouredoingitwrongjavaone2009-090617031310-phpapp02.pdf
stateyouredoingitwrongjavaone2009-090617031310-phpapp02.pdfHiroshi Ono
Ā 
program_draft3.pdf
program_draft3.pdfprogram_draft3.pdf
program_draft3.pdfHiroshi Ono
Ā 
nodalities_issue7.pdf
nodalities_issue7.pdfnodalities_issue7.pdf
nodalities_issue7.pdfHiroshi Ono
Ā 
genpaxospublic-090703114743-phpapp01.pdf
genpaxospublic-090703114743-phpapp01.pdfgenpaxospublic-090703114743-phpapp01.pdf
genpaxospublic-090703114743-phpapp01.pdfHiroshi Ono
Ā 
kademlia-1227143905867010-8.pdf
kademlia-1227143905867010-8.pdfkademlia-1227143905867010-8.pdf
kademlia-1227143905867010-8.pdfHiroshi Ono
Ā 
pragmaticrealworldscalajfokus2009-1233251076441384-2.pdf
pragmaticrealworldscalajfokus2009-1233251076441384-2.pdfpragmaticrealworldscalajfokus2009-1233251076441384-2.pdf
pragmaticrealworldscalajfokus2009-1233251076441384-2.pdfHiroshi Ono
Ā 
downey08semaphores.pdf
downey08semaphores.pdfdowney08semaphores.pdf
downey08semaphores.pdfHiroshi Ono
Ā 

More from Hiroshi Ono (20)

Voltdb - wikipedia
Voltdb - wikipediaVoltdb - wikipedia
Voltdb - wikipedia
Ā 
GamecenterꦂčŖ¬
GamecenterꦂčŖ¬GamecenterꦂčŖ¬
GamecenterꦂčŖ¬
Ā 
EventDrivenArchitecture
EventDrivenArchitectureEventDrivenArchitecture
EventDrivenArchitecture
Ā 
nodalities_issue7.pdf
nodalities_issue7.pdfnodalities_issue7.pdf
nodalities_issue7.pdf
Ā 
genpaxospublic-090703114743-phpapp01.pdf
genpaxospublic-090703114743-phpapp01.pdfgenpaxospublic-090703114743-phpapp01.pdf
genpaxospublic-090703114743-phpapp01.pdf
Ā 
kademlia-1227143905867010-8.pdf
kademlia-1227143905867010-8.pdfkademlia-1227143905867010-8.pdf
kademlia-1227143905867010-8.pdf
Ā 
pragmaticrealworldscalajfokus2009-1233251076441384-2.pdf
pragmaticrealworldscalajfokus2009-1233251076441384-2.pdfpragmaticrealworldscalajfokus2009-1233251076441384-2.pdf
pragmaticrealworldscalajfokus2009-1233251076441384-2.pdf
Ā 
downey08semaphores.pdf
downey08semaphores.pdfdowney08semaphores.pdf
downey08semaphores.pdf
Ā 
BOF1-Scala02.pdf
BOF1-Scala02.pdfBOF1-Scala02.pdf
BOF1-Scala02.pdf
Ā 
TwitterOct2008.pdf
TwitterOct2008.pdfTwitterOct2008.pdf
TwitterOct2008.pdf
Ā 
camel-scala.pdf
camel-scala.pdfcamel-scala.pdf
camel-scala.pdf
Ā 
stateyouredoingitwrongjavaone2009-090617031310-phpapp02.pdf
stateyouredoingitwrongjavaone2009-090617031310-phpapp02.pdfstateyouredoingitwrongjavaone2009-090617031310-phpapp02.pdf
stateyouredoingitwrongjavaone2009-090617031310-phpapp02.pdf
Ā 
SACSIS2009_TCP.pdf
SACSIS2009_TCP.pdfSACSIS2009_TCP.pdf
SACSIS2009_TCP.pdf
Ā 
stateyouredoingitwrongjavaone2009-090617031310-phpapp02.pdf
stateyouredoingitwrongjavaone2009-090617031310-phpapp02.pdfstateyouredoingitwrongjavaone2009-090617031310-phpapp02.pdf
stateyouredoingitwrongjavaone2009-090617031310-phpapp02.pdf
Ā 
program_draft3.pdf
program_draft3.pdfprogram_draft3.pdf
program_draft3.pdf
Ā 
nodalities_issue7.pdf
nodalities_issue7.pdfnodalities_issue7.pdf
nodalities_issue7.pdf
Ā 
genpaxospublic-090703114743-phpapp01.pdf
genpaxospublic-090703114743-phpapp01.pdfgenpaxospublic-090703114743-phpapp01.pdf
genpaxospublic-090703114743-phpapp01.pdf
Ā 
kademlia-1227143905867010-8.pdf
kademlia-1227143905867010-8.pdfkademlia-1227143905867010-8.pdf
kademlia-1227143905867010-8.pdf
Ā 
pragmaticrealworldscalajfokus2009-1233251076441384-2.pdf
pragmaticrealworldscalajfokus2009-1233251076441384-2.pdfpragmaticrealworldscalajfokus2009-1233251076441384-2.pdf
pragmaticrealworldscalajfokus2009-1233251076441384-2.pdf
Ā 
downey08semaphores.pdf
downey08semaphores.pdfdowney08semaphores.pdf
downey08semaphores.pdf
Ā 

Recently uploaded

Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
Ā 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
Ā 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
Ā 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
Ā 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsRoshan Dwivedi
Ā 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
Ā 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
Ā 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service šŸø 8923113531 šŸŽ° Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service šŸø 8923113531 šŸŽ° Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service šŸø 8923113531 šŸŽ° Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service šŸø 8923113531 šŸŽ° Avail...gurkirankumar98700
Ā 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
Ā 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
Ā 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
Ā 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
Ā 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilV3cube
Ā 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
Ā 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
Ā 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
Ā 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
Ā 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
Ā 
šŸ¬ The future of MySQL is Postgres šŸ˜
šŸ¬  The future of MySQL is Postgres   šŸ˜šŸ¬  The future of MySQL is Postgres   šŸ˜
šŸ¬ The future of MySQL is Postgres šŸ˜RTylerCroy
Ā 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
Ā 

Recently uploaded (20)

Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Ā 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
Ā 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Ā 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
Ā 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Ā 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
Ā 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
Ā 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service šŸø 8923113531 šŸŽ° Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service šŸø 8923113531 šŸŽ° Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service šŸø 8923113531 šŸŽ° Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service šŸø 8923113531 šŸŽ° Avail...
Ā 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
Ā 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
Ā 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
Ā 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
Ā 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
Ā 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
Ā 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
Ā 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
Ā 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
Ā 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Ā 
šŸ¬ The future of MySQL is Postgres šŸ˜
šŸ¬  The future of MySQL is Postgres   šŸ˜šŸ¬  The future of MySQL is Postgres   šŸ˜
šŸ¬ The future of MySQL is Postgres šŸ˜
Ā 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
Ā 

New Iterator Concepts Proposes Separating Access and Positioning

  • 1. New Iterator Concepts Author: David Abrahams, Jeremy Siek, Thomas Witt Contact: dave@boost-consulting.com, jsiek@osl.iu.edu, witt@styleadvisor.com Organization: Boost Consulting, Indiana University Open Systems Lab, Zephyr Asso- ciates, Inc. Date: 2004-11-01 Number: This is a revised version of n1550=03-0133, which was accepted for Tech- nical Report 1 by the C++ standard committeeā€™s library working group. This proposal is a revision of paper n1297, n1477, and n1531. Copyright: Copyright David Abrahams, Jeremy Siek, and Thomas Witt 2003. Abstract: We propose a new system of iterator concepts that treat access and positioning independently. This allows the concepts to more closely match the requirements of algorithms and provides better categorizations of iterators that are used in practice. Table of Contents Motivation Impact on the Standard Possible (but not proposed) Changes to the Working Paper Changes to Algorithm Requirements Deprecations vector<bool> Design Proposed Text Addition to [lib.iterator.requirements] Iterator Value Access Concepts [lib.iterator.value.access] Readable Iterators [lib.readable.iterators] Writable Iterators [lib.writable.iterators] Swappable Iterators [lib.swappable.iterators] Lvalue Iterators [lib.lvalue.iterators] Iterator Traversal Concepts [lib.iterator.traversal] Incrementable Iterators [lib.incrementable.iterators] Single Pass Iterators [lib.single.pass.iterators] Forward Traversal Iterators [lib.forward.traversal.iterators] Bidirectional Traversal Iterators [lib.bidirectional.traversal.iterators] Random Access Traversal Iterators [lib.random.access.traversal.iterators] Interoperable Iterators [lib.interoperable.iterators] 1
  • 2. Addition to [lib.iterator.synopsis] Addition to [lib.iterator.traits] Footnotes Motivation The standard iterator categories and requirements are ļ¬‚awed because they use a single hierarchy of concepts to address two orthogonal issues: iterator traversal and value access. As a result, many algorithms with requirements expressed in terms of the iterator categories are too strict. Also, many real-world iterators can not be accurately categorized. A proxy-based iterator with random-access traversal, for example, may only legally have a category of ā€œinput iteratorā€, so generic algorithms are unable to take advantage of its random-access capabilities. The current iterator concept hierarchy is geared towards iterator traversal (hence the category names), while requirements that address value access sneak in at various places. The following table gives a summary of the current value access requirements in the iterator categories. Value Access Requirements in Existing Iterator Categories Output Iterator *i = a Input Iterator *i is convertible to T Forward Iterator *i is T& (or const T& once issue 200 is resolved) Random Access Iterator i[n] is convertible to T (also i[n] = t is required for mutable iterators once issue 299 is resolved) Because iterator traversal and value access are mixed together in a single hierarchy, many useful iterators can not be appropriately categorized. For example, vector<bool>::iterator is almost a random access iterator, but the return type is not bool& (see issue 96 and Herb Sutterā€™s paper J16/99- 0008 = WG21 N1185). Therefore, the iterators of vector<bool> only meet the requirements of input iterator and output iterator. This is so nonintuitive that the C++ standard contradicts itself on this point. In paragraph 23.2.4/1 it says that a vector is a sequence that supports random access iterators. Another diļ¬ƒcult-to-categorize iterator is the transform iterator, an adaptor which applies a unary function object to the dereferenced value of the some underlying iterator (see transform iterator). For unary functions such as times, the return type of operator* clearly needs to be the result_type of the function object, which is typically not a reference. Because random access iterators are required to return lvalues from operator*, if you wrap int* with a transform iterator, you do not get a random access iterator as might be expected, but an input iterator. A third example is found in the vertex and edge iterators of the Boost Graph Library. These iterators return vertex and edge descriptors, which are lightweight handles created on-the-ļ¬‚y. They must be returned by-value. As a result, their current standard iterator category is input_iterator_tag, which means that, strictly speaking, you could not use these iterators with algorithms like min_element(). As a temporary solution, the concept Multi-Pass Input Iterator was introduced to describe the vertex and edge descriptors, but as the design notes for the concept suggest, a better solution is needed. In short, there are many useful iterators that do not ļ¬t into the current standard iterator categories. As a result, the following bad things happen: ā€¢ Iterators are often mis-categorized. ā€¢ Algorithm requirements are more strict than necessary, because they cannot separate the need for random access or bidirectional traversal from the need for a true reference return type. 2
  • 3. Impact on the Standard This proposal for TR1 is a pure extension. Further, the new iterator concepts are backward-compatible with the old iterator requirements, and old iterators are forward-compatible with the new iterator concepts. That is to say, iterators that satisfy the old requirements also satisfy appropriate concepts in the new system, and iterators modeling the new concepts will automatically satisfy the appropriate old requirements. Possible (but not proposed) Changes to the Working Paper The extensions in this paper suggest several changes we might make to the working paper for the next standard. These changes are not a formal part of this proposal for TR1. Changes to Algorithm Requirements The algorithms in the standard library could beneļ¬t from the new iterator concepts because the new concepts provide a more accurate way to express their type requirements. The result is algorithms that are usable in more situations and have fewer type requirements. For the next working paper (but not for TR1), the committee should consider the following changes to the type requirements of algorithms. These changes are phrased as textual substitutions, listing the algorithms to which each textual substitution applies. Forward Iterator -> Forward Traversal Iterator and Readable Iterator find_end, adjacent_find, search, search_n, rotate_copy, lower_bound, upper_bound, equal_range, binary_search, min_element, max_element Forward Iterator (1) -> Single Pass Iterator and Readable Iterator, Forward Iterator (2) -> Forward Traversal Iterator and Readable Iterator find_first_of Forward Iterator -> Readable Iterator and Writable Iterator iter_swap Forward Iterator -> Single Pass Iterator and Writable Iterator fill, generate Forward Iterator -> Forward Traversal Iterator and Swappable Iterator rotate Forward Iterator (1) -> Swappable Iterator and Single Pass Iterator, Forward Iterator (2) -> Swap- pable Iterator and Incrementable Iterator swap_ranges Forward Iterator -> Forward Traversal Iterator and Readable Iterator and Writable Iterator remove, remove_if, unique Forward Iterator -> Single Pass Iterator and Readable Iterator and Writable Iterator replace, replace_if Bidirectional Iterator -> Bidirectional Traversal Iterator and Swappable Iterator reverse Bidirectional Iterator -> Bidirectional Traversal Iterator and Readable and Swappable Iterator partition 3
  • 4. Bidirectional Iterator (1) -> Bidirectional Traversal Iterator and Readable Iterator, Bidirectional Iterator (2) -> Bidirectional Traversal Iterator and Writable Iterator copy_backwards Bidirectional Iterator -> Bidirectional Traversal Iterator and Swappable Iterator and Readable Iterator next_permutation, prev_permutation Bidirectional Iterator -> Bidirectional Traversal Iterator and Readable Iterator and Writable Iterator stable_partition, inplace_merge Bidirectional Iterator -> Bidirectional Traversal Iterator and Readable Iterator reverse_copy Random Access Iterator -> Random Access Traversal Iterator and Readable and Writable Iterator random_shuffle, sort, stable_sort, partial_sort, nth_element, push_heap, pop_heap make_heap, sort_heap Input Iterator (2) -> Incrementable Iterator and Readable Iterator equal, mismatch Input Iterator (2) -> Incrementable Iterator and Readable Iterator transform Deprecations For the next working paper (but not for TR1), the committee should consider deprecating the old iterator tags, and std::iterator traits, since it will be superceded by individual traits metafunctions. vector<bool> For the next working paper (but not for TR1), the committee should consider reclassifying vec- tor<bool>::iterator as a Random Access Traversal Iterator and Readable Iterator and Writable Iterator. Design The iterator requirements are to be separated into two groups. One set of concepts handles the syntax and semantics of value access: ā€¢ Readable Iterator ā€¢ Writable Iterator ā€¢ Swappable Iterator ā€¢ Lvalue Iterator The access concepts describe requirements related to operator* and operator->, including the value_type, reference, and pointer associated types. The other set of concepts handles traversal: ā€¢ Incrementable Iterator ā€¢ Single Pass Iterator ā€¢ Forward Traversal Iterator ā€¢ Bidirectional Traversal Iterator ā€¢ Random Access Traversal Iterator 4
  • 5. The reļ¬nement relationships for the traversal concepts are in the following diagram. In addition to the iterator movement operators, such as operator++, the traversal concepts also include requirements on position comparison such as operator== and operator<. The reason for the ļ¬ne grain slicing of the concepts into the Incrementable and Single Pass is to provide concepts that are exact matches with the original input and output iterator requirements. This proposal also includes a concept for specifying when an iterator is interoperable with another iterator, in the sense that int* is interoperable with int const*. ā€¢ Interoperable Iterators The relationship between the new iterator concepts and the old are given in the following diagram. Like the old iterator requirements, we provide tags for purposes of dispatching based on the traversal concepts. The tags are related via inheritance so that a tag is convertible to another tag if the concept associated with the ļ¬rst tag is a reļ¬nement of the second tag. Our design reuses iterator_traits<Iter>::iterator_category to indicate an iteratorā€™s traversal capability. To specify capabilities not captured by any old-style iterator category, an iterator designer can use an iterator_category type that is convertible to both the the most-derived old iterator 5
  • 6. category tag which ļ¬ts, and the appropriate new iterator traversal tag. We do not provide tags for the purposes of dispatching based on the access concepts, in part because we could not ļ¬nd a way to automatically infer the right access tags for old-style iterators. An iteratorā€™s writability may be dependent on the assignability of its value_type and thereā€™s no known way to detect whether an arbitrary type is assignable. Fortunately, the need for dispatching based on access capability is not as great as the need for dispatching based on traversal capability. A diļ¬ƒcult design decision concerned the operator[]. The direct approach for specifying operator[] would have a return type of reference; the same as operator*. However, going in this direction would mean that an iterator satisfying the old Random Access Iterator requirements would not necessarily be a model of Readable or Writable Lvalue Iterator. Instead we have chosen a design that matches the preferred resolution of issue 299: operator[] is only required to return something convertible to the value_type (for a Readable Iterator), and is required to support assignment i[n] = t (for a Writable Iterator). Proposed Text Addition to [lib.iterator.requirements] Iterator Value Access Concepts [lib.iterator.value.access] In the tables below, X is an iterator type, a is a constant object of type X, R is std::iterator_traits<X>::reference, T is std::iterator_traits<X>::value_type, and v is a constant object of type T. Readable Iterators [lib.readable.iterators] A class or built-in type X models the Readable Iterator concept for value type T if, in addition to X being Assignable and Copy Constructible, the following expressions are valid and respect the stated semantics. U is the type of any speciļ¬ed member of type T. Readable Iterator Requirements (in addition to Assignable and Copy Constructible) Expression Return Type Note/Precondition iterator_traits<X>::value_type T Any non-reference, non-cv-qualiļ¬ed type *a Convertible to T pre: a is dereferenceable. If a == b then *a is equivalent to *b. a->m U& pre: pre: (*a).m is well-deļ¬ned. Equivalent to (*a).m. Writable Iterators [lib.writable.iterators] A class or built-in type X models the Writable Iterator concept if, in addition to X being Copy Con- structible, the following expressions are valid and respect the stated semantics. Writable Iterators have an associated set of value types. Writable Iterator Requirements (in addition to Copy Constructible) Expression Return Type Precondition *a = o pre: The type of o is in the set of value types of X 6
  • 7. Swappable Iterators [lib.swappable.iterators] A class or built-in type X models the Swappable Iterator concept if, in addition to X being Copy Con- structible, the following expressions are valid and respect the stated semantics. Swappable Iterator Requirements (in addition to Copy Constructible) Expression Return Type Postcondition iter_swap(a, b) void the pointed to values are exchanged [Note: An iterator that is a model of the Readable Iterator and Writable Iterator concepts is also a model of Swappable Iterator. --end note] Lvalue Iterators [lib.lvalue.iterators] The Lvalue Iterator concept adds the requirement that the return type of operator* type be a reference to the value type of the iterator. Lvalue Iterator Requirements Expression Return Note/Assertion Type *a T& T is cv iterator_traits<X>::value_type where cv is an optional cv-qualiļ¬cation. pre: a is dereferenceable. If X is a Writable Iterator then a == b if and only if *a is the same object as *b. If X is a Readable Iterator then a == b implies *a is the same object as *b. Iterator Traversal Concepts [lib.iterator.traversal] In the tables below, X is an iterator type, a and b are constant objects of type X, r and s are mutable objects of type X, T is std::iterator_traits<X>::value_type, and v is a constant object of type T. Incrementable Iterators [lib.incrementable.iterators] A class or built-in type X models the Incrementable Iterator concept if, in addition to X being Assignable and Copy Constructible, the following expressions are valid and respect the stated semantics. Incrementable Iterator Requirements (in addition to Assignable, Copy Constructible) Expression Return Type Assertion ++r X& &r == &++r r++ *r++ iterator_traversal<X>::type Convertible to incre- mentable_traversal_tag If X is a Writable Iterator then X a(r++); is equivalent to X a(r); ++r; and *r++ = o is equivalent to *r = o; ++r. If X is a Readable Iterator then T z(*r++); is equivalent to T z(*r); ++r;. Single Pass Iterators [lib.single.pass.iterators] A class or built-in type X models the Single Pass Iterator concept if the following expressions are valid and respect the stated semantics. 7
  • 8. Single Pass Iterator Requirements (in addition to Incrementable Iterator and Equality Comparable) Expression Return Type Oper- Assertion/ Pre- ational /Post-condition Semantics ++r X& pre: r is dereferenceable; post: r is dereference- able or r is past-the-end a == b convertible to bool == is an equivalence rela- tion over its domain a != b convertible to bool !(a == b) A signed integral type iterator_traits<X>::difference_type representing the distance between iterators iterator_traversal<X>::type Convertible to sin- gle_pass_traversal_tag Forward Traversal Iterators [lib.forward.traversal.iterators] A class or built-in type X models the Forward Traversal Iterator concept if, in addition to X meeting the requirements of Default Constructible and Single Pass Iterator, the following expressions are valid and respect the stated semantics. Forward Traversal Iterator Requirements (in addition to Default Constructible and Single Pass Iterat Expression Return Type Assertion/Note X u; X& note: u may have a singu- lar value. ++r X& r == s and r is deref- erenceable implies ++r == ++s. iterator_traversal<X>::type Convertible to for- ward_traversal_tag Bidirectional Traversal Iterators [lib.bidirectional.traversal.iterators] A class or built-in type X models the Bidirectional Traversal Iterator concept if, in addition to X meeting the requirements of Forward Traversal Iterator, the following expressions are valid and respect the stated semantics. Bidirectional Traversal Iterator Requirements (in addition to Forward Traversal Iterator) Expression Return Type Operational Assertion/ Pre- Semantics /Post-condition --r X& pre: there exists s such that r == ++s. post: s is dereference- able. ++(--r) == r. --r == --s implies r == s. &r == &--r. r-- convertible to const X& { X tmp = r; --r; re- turn tmp; } 8
  • 9. Bidirectional Traversal Iterator Requirements (in addition to Forward Traversal Iterator) Expression Return Type Operational Assertion/ Pre- Semantics /Post-condition iterator_traversal<X>::type Convertible to bidirec- tional_traversal_tag Random Access Traversal Iterators [lib.random.access.traversal.iterators] A class or built-in type X models the Random Access Traversal Iterator concept if the following expressions are valid and respect the stated semantics. In the table below, Distance is itera- tor_traits<X>::difference_type and n represents a constant object of type Distance. Random Access Traversal Iterator Requirements (in addition to Bidirectional Traversal Iterator) Expression Return Type Operational Se- Assertion/ Pre- mantics condition r += n X& { Distance m = n; if (m >= 0) while (m--) ++r; else while (m++) --r; return r; } a + n, n + a X { X tmp = a; re- turn tmp += n; } r -= n X& return r += -n a - n X { X tmp = a; re- turn tmp -= n; } b - a Distance a < b ? dis- pre: there exists a tance(a,b) : - value n of Distance distance(b,a) such that a + n == b. b == a + (b - a). a[n] convertible to T *(a + n) pre: a is a Readable Iterator a[n] = v convertible to T *(a + n) = v pre: a is a Writable Iterator a < b convertible to bool b - a > 0 < is a total ordering relation a > b convertible to bool b < a > is a total ordering relation a >= b convertible to bool !(a < b) a <= b convertible to bool !(a > b) Convertible iterator_traversal<X>::type to ran- dom_access_traversal_tag 9
  • 10. Interoperable Iterators [lib.interoperable.iterators] A class or built-in type X that models Single Pass Iterator is interoperable with a class or built-in type Y that also models Single Pass Iterator if the following expressions are valid and respect the stated semantics. In the tables below, x is an object of type X, y is an object of type Y, Distance is iterator_traits<Y>::difference_type, and n represents a constant object of type Distance. Expres- Return Type Assertion/Precondition/Postcondition sion y = x Y post: y == x Y(x) Y post: Y(x) == x x == y convertible to bool == is an equivalence relation over its domain. y == x convertible to bool == is an equivalence relation over its domain. x != y convertible to bool bool(a==b) != bool(a!=b) over its domain. y != x convertible to bool bool(a==b) != bool(a!=b) over its domain. If X and Y both model Random Access Traversal Iterator then the following additional requirements must be met. Expres- Return Type Operational Se- Assertion/ Precondition sion mantics x < y convertible to bool y - x > 0 < is a total ordering relation y < x convertible to bool x - y > 0 < is a total ordering relation x > y convertible to bool y < x > is a total ordering relation y > x convertible to bool x < y > is a total ordering relation x >= y convertible to bool !(x < y) y >= x convertible to bool !(y < x) x <= y convertible to bool !(x > y) y <= x convertible to bool !(y > x) y - x Distance distance(Y(x),y) pre: there exists a value n of Distance such that x + n == y. y == x + (y - x). x - y Distance distance(y,Y(x)) pre: there exists a value n of Distance such that y + n == x. x == y + (x - y). Addition to [lib.iterator.synopsis] // lib.iterator.traits, traits and tags template <class Iterator> struct is_readable_iterator; template <class Iterator> struct iterator_traversal; struct incrementable_traversal_tag { }; struct single_pass_traversal_tag : incrementable_traversal_tag { }; struct forward_traversal_tag : single_pass_traversal_tag { }; struct bidirectional_traversal_tag : forward_traversal_tag { }; struct random_access_traversal_tag : bidirectional_traversal_tag { }; Addition to [lib.iterator.traits] The is_readable_iterator class template satisļ¬es the UnaryTypeTrait requirements. 10
  • 11. Given an iterator type X, is_readable_iterator<X>::value yields true if, for an object a of type X, *a is convertible to iterator_traits<X>::value_type, and false otherwise. iterator_traversal<X>::type is category-to-traversal (iterator_traits<X>::iterator_category) where category-to-traversal is deļ¬ned as follows category-to-traversal (C) = if (C is convertible to incrementable_traversal_tag) return C; else if (C is convertible to random_access_iterator_tag) return random_access_traversal_tag; else if (C is convertible to bidirectional_iterator_tag) return bidirectional_traversal_tag; else if (C is convertible to forward_iterator_tag) return forward_traversal_tag; else if (C is convertible to input_iterator_tag) return single_pass_traversal_tag; else if (C is convertible to output_iterator_tag) return incrementable_traversal_tag; else the program is ill-formed Footnotes The UnaryTypeTrait concept is deļ¬ned in n1519; the LWG is considering adding the requirement that specializations are derived from their nested ::type. 11