Skip to content

Instantly share code, notes, and snippets.

@loliGothicK
Created April 12, 2018 19:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save loliGothicK/e174fb72896b0320e55440aa70b5513a to your computer and use it in GitHub Desktop.
Save loliGothicK/e174fb72896b0320e55440aa70b5513a to your computer and use it in GitHub Desktop.
#include <array>
#include <utility>
#include <iostream>
template < std::size_t N >
constexpr auto ints = []{
std::array<std::size_t, N> arr{};
for( std::size_t i{}; i < N; ++i ) arr[i] = i;
return arr;
}();
int main() {
constexpr auto range = ints<10>;
for(auto elem: range) std::cout << elem << " ";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment