Skip to content

sonulen/enumerate

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

Python-like loop enumeration in C++

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published