Skip to content

Instantly share code, notes, and snippets.

@Redchards
Last active October 9, 2015 10:03
Show Gist options
  • Save Redchards/40843fee8b27bc84aefc to your computer and use it in GitHub Desktop.
Save Redchards/40843fee8b27bc84aefc to your computer and use it in GitHub Desktop.
Simple number serie generation using C++ metaprogramming
template<size_t last>
void printNumbers()
{
std::cout << last << std::endl;
}
template<size_t head1, size_t head2, size_t... tail>
void printNumbers()
{
std::cout << head1 << std::endl;
printNumbers<head2, tail...>();
}
template<size_t... list>
void printNumbers(NumberList<list...>)
{
printNumbers<list...>();
}
template<size_t... list>
void printNumbersList<list...>)
{
printNumbers<list...>();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment