fork(5) download
  1. #include <iostream>
  2.  
  3. template < typename T, T b, unsigned int e >
  4. struct pow : std::integral_constant< decltype(b*1), b * pow<T,b,e-1>::value > {} ;
  5.  
  6. template < typename T, T b >
  7. struct pow<T,b,0> : std::integral_constant< decltype(b*1), 1 > {} ;
  8.  
  9. int main()
  10. {
  11. std::cout << pow< char, 'd', 3 >::value << '\n' ;
  12. }
  13.  
Success #stdin #stdout 0s 3296KB
stdin
Standard input is empty
stdout
1000000