Skip to content

Latest commit

 

History

History
34 lines (22 loc) · 505 Bytes

README.md

File metadata and controls

34 lines (22 loc) · 505 Bytes

enumerate

Python-like loop enumeration in C++

Basics

#include <enumerate.hpp>

And use:

#include <array>
#include <enumerate.hpp>
#include <iostream>

using mtl::enumerate;

int main(int argc, const char* argv[]) {
    std::array<double, 10> array{10, 9, 8, 7, 6, 5, 4, 3, 2, 1};
    for (const auto& [i, v] : enumerate(array)) {
        std::cout << "Index : " << i << " with value: " << v << std::endl;
    }
    return 0;
}

Linking

This is a header only library.