Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 1 template <long N, long M1, long M2, long M3> struct Factorial
- 2 {
- 3 enum { val = Factorial<N-1, M1, M2, M3 + 1>::val };
- 4 enum { val2 = Factorial<N-1, M2, M1 + 1, M3>::val };
- 5 enum { val3 = Factorial<N-1, M3 + 1, M2, M1>::val };
- 6 int foo1(int a, int b = N, int c = M1) { return 1; }
- 7 int foo2(int a, int b = N, int c = M2) { return 2; }
- 8 int foo3(int a, int b = N, int c = M3) { return 3; }
- 9 };
- 10 template<long m1, long m2, long m3>
- 11 struct Factorial<0, m1, m2, m3>
- 12 {
- 13 enum { val = 0 };
- 14 };
- 15 int main()
- 16 {
- 17 return Factorial<60, 1000, 2000, 3000>::val;
- 18 }
Add Comment
Please, Sign In to add comment