fork download
  1. #include <iostream>
  2.  
  3. template < unsigned int N, unsigned int P > struct cpow
  4. { enum { value = cpow<N,P-1>::value * N }; };
  5.  
  6. template < unsigned int N > struct cpow<N,0>
  7. { enum { value = 1 }; };
  8.  
  9. struct A
  10. {
  11. int my_array[ cpow<2,8>::value ] ;
  12. };
  13.  
  14. int main()
  15. {
  16. std::cout << sizeof(A) << '\n' ;
  17. }
  18.  
Success #stdin #stdout 0s 2728KB
stdin
Standard input is empty
stdout
1024