GoddamnIDontNeedAUse

Untitled

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