.. Generated automatically by cpp2rst .. highlight:: c .. role:: red .. role:: green .. role:: param .. _itertools__enumerate: itertools::enumerate ==================== *#include * **Synopsis** .. rst-class:: cppsynopsis | :green:`template` | :ref:`enumerated\ ` :red:`enumerate` (R && :param:`rg`) Template parameters ^^^^^^^^^^^^^^^^^^^ * :param:`R` Range type. Parameters ^^^^^^^^^^ * :param:`rg` Range to enumerate. Returns ^^^^^^^ A itertools::enumerated range. Example ^^^^^^^ .. Included automatically from /src/triqs/doc/documentation/examples/itertools/enumerate.cpp .. code-block:: cpp #include #include #include int main() { std::vector v{10, 11, 12, 13, 14}; for (auto [n, x] : itertools::enumerate(v)) std::cout << n << " " << x << std::endl; } *Output* .. code-block:: text 0 10 1 11 2 12 3 13 4 14