fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. template<int x>
  5. class A { public: int eval(){ return x; }; };
  6.  
  7. template<int x, int y, int z>
  8. class B { public: int eval(){ return x+y+z; }; };
  9.  
  10. template<int... Args1, int... Args2, template <int...> class T1, template <int...> class T2>
  11. int operator+(T1<Args1...> a, T2<Args2...> b)
  12. {
  13. return a.eval() + b.eval();
  14. }
  15.  
  16. int main() {
  17. A<1> a;
  18. B<2,3,4> b;
  19. cout << a+b << endl;
  20.  
  21. // your code goes here
  22. return 0;
  23. }
Success #stdin #stdout 0s 3096KB
stdin
Standard input is empty
stdout
10