Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- template <int n> struct factorial {
- enum {
- value = n * factorial<n - 1>::value
- };
- };
- template <> struct factorial <1> {
- enum {
- value = 1
- };
- };
- int main() {
- printf("%d\n", factorial<8>::value);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement