2013-07-17 19:24:07 +02:00
|
|
|
.. highlight:: c
|
|
|
|
|
|
|
|
.. _STL:
|
|
|
|
|
|
|
|
Iterators and STL
|
|
|
|
##################################################################
|
|
|
|
|
|
|
|
Standard iterators are provided that model the boost Mutable_ForwardIterator and ForwardIterator concepts
|
|
|
|
(and hence are STL compliant).
|
|
|
|
|
|
|
|
The iterator implements also two additional methods :
|
|
|
|
|
2014-10-17 18:15:19 +02:00
|
|
|
* it can be casted to a bool: it is true iif the iteration is not at end.
|
|
|
|
* it.indices(): returns const & to the indices at the point of the iteration.
|
2013-07-17 19:24:07 +02:00
|
|
|
|
|
|
|
Examples::
|
|
|
|
|
|
|
|
array<long,2> A (2,3);
|
|
|
|
for (auto it = A.begin(); it; ++it) *it =it.indices()[0] + 10 *it.indices()[1];
|
|
|
|
|
|
|
|
|
2014-10-17 18:15:19 +02:00
|
|
|
Some examples of usage:
|
2013-07-17 19:24:07 +02:00
|
|
|
|
|
|
|
|
2014-05-31 19:12:21 +02:00
|
|
|
.. triqs_example:: ./STL_0.cpp
|