1 .. Copyright David Abrahams 2006. Distributed under the Boost
2 .. Software License, Version 1.0. (See accompanying
3 .. file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
7 template< class ElementIterator
9 , class ValueT = use_default
10 , class CategoryT = use_default
11 , class ReferenceT = use_default
12 , class DifferenceT = use_default >
13 class permutation_iterator
16 permutation_iterator();
17 explicit permutation_iterator(ElementIterator x, IndexIterator y);
19 template< class OEIter, class OIIter, class V, class C, class R, class D >
21 permutation_iterator<OEIter, OIIter, V, C, R, D> const& r
22 , typename enable_if_convertible<OEIter, ElementIterator>::type* = 0
23 , typename enable_if_convertible<OIIter, IndexIterator>::type* = 0
25 reference operator*() const;
26 permutation_iterator& operator++();
27 ElementIterator const& base() const;
29 ElementIterator m_elt; // exposition only
30 IndexIterator m_order; // exposition only
33 template <class ElementIterator, class IndexIterator>
34 permutation_iterator<ElementIterator, IndexIterator>
35 make_permutation_iterator( ElementIterator e, IndexIterator i);
39 ``permutation_iterator`` requirements
40 -------------------------------------
42 ``ElementIterator`` shall model Random Access Traversal Iterator.
43 ``IndexIterator`` shall model Readable Iterator. The value type of
44 the ``IndexIterator`` must be convertible to the difference type of
48 ``permutation_iterator`` models
49 -------------------------------
51 ``permutation_iterator`` models the same iterator traversal concepts
52 as ``IndexIterator`` and the same iterator access concepts as
55 If ``IndexIterator`` models Single Pass Iterator and
56 ``ElementIterator`` models Readable Iterator then
57 ``permutation_iterator`` models Input Iterator.
59 If ``IndexIterator`` models Forward Traversal Iterator and
60 ``ElementIterator`` models Readable Lvalue Iterator then
61 ``permutation_iterator`` models Forward Iterator.
63 If ``IndexIterator`` models Bidirectional Traversal Iterator and
64 ``ElementIterator`` models Readable Lvalue Iterator then
65 ``permutation_iterator`` models Bidirectional Iterator.
67 If ``IndexIterator`` models Random Access Traversal Iterator and
68 ``ElementIterator`` models Readable Lvalue Iterator then
69 ``permutation_iterator`` models Random Access Iterator.
71 ``permutation_iterator<E1, X, V1, C2, R1, D1>`` is interoperable
72 with ``permutation_iterator<E2, Y, V2, C2, R2, D2>`` if and only if
73 ``X`` is interoperable with ``Y`` and ``E1`` is convertible
77 ``permutation_iterator`` operations
78 -----------------------------------
80 In addition to those operations required by the concepts that
81 ``permutation_iterator`` models, ``permutation_iterator`` provides the
84 ``permutation_iterator();``
86 :Effects: Default constructs ``m_elt`` and ``m_order``.
89 ``explicit permutation_iterator(ElementIterator x, IndexIterator y);``
91 :Effects: Constructs ``m_elt`` from ``x`` and ``m_order`` from ``y``.
96 template< class OEIter, class OIIter, class V, class C, class R, class D >
98 permutation_iterator<OEIter, OIIter, V, C, R, D> const& r
99 , typename enable_if_convertible<OEIter, ElementIterator>::type* = 0
100 , typename enable_if_convertible<OIIter, IndexIterator>::type* = 0
103 :Effects: Constructs ``m_elt`` from ``r.m_elt`` and
104 ``m_order`` from ``y.m_order``.
107 ``reference operator*() const;``
109 :Returns: ``*(m_elt + *m_order)``
112 ``permutation_iterator& operator++();``
114 :Effects: ``++m_order``
118 ``ElementIterator const& base() const;``
120 :Returns: ``m_order``
125 template <class ElementIterator, class IndexIterator>
126 permutation_iterator<ElementIterator, IndexIterator>
127 make_permutation_iterator(ElementIterator e, IndexIterator i);
129 :Returns: ``permutation_iterator<ElementIterator, IndexIterator>(e, i)``