Last active
October 9, 2015 10:03
-
-
Save Redchards/40843fee8b27bc84aefc to your computer and use it in GitHub Desktop.
Simple number serie generation using C++ metaprogramming
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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