fork download
  1. #include <iostream>
  2.  
  3. template<typename T>
  4. constexpr T mult(T a){
  5. return a;
  6. }
  7.  
  8. template<typename T, typename ... Values>
  9. constexpr T mult(T a, Values ... rest){
  10. return a * mult(rest...);
  11. }
  12.  
  13. int main()
  14. {
  15. constexpr int value = mult(1,2,3,4,5);
  16.  
  17. std::cout<<(1*2*3*4*5)<<std::endl;
  18. std::cout<<value<<std::endl;
  19. return 0;
  20. }
Success #stdin #stdout 0s 3468KB
stdin
Standard input is empty
stdout
120
120