fork download
  1. #include <iostream>
  2.  
  3. template <int I1, int I2>
  4. struct adder
  5. {
  6. static const int i1 = I1;
  7. static const int i2 = I2;
  8. };
  9.  
  10. template <typename A, int I>
  11. struct fusedmultiplyadder
  12. {
  13. typedef A a;
  14. static const int i = I;
  15. };
  16.  
  17. template <typename a, int i>
  18. void foo(fusedmultiplyadder<a, i>)
  19. {
  20. std::cout << "fma: " << a::i1 << ", " << a::i2 << ", " << i << std::endl;
  21. }
  22.  
  23. int main()
  24. {
  25. fusedmultiplyadder<adder<2, 3>, 4> fma;
  26. foo(fma);
  27. return 0;
  28. }
Success #stdin #stdout 0s 2928KB
stdin
Standard input is empty
stdout
fma: 2, 3, 4