fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. struct POINT
  5. {
  6. long x = 0;
  7. long y = 0;
  8. };
  9.  
  10. template<typename RetType, typename ...Params>
  11. struct func
  12. {
  13. template<typename R, typename ...P>
  14. R operator()( P&&... p )
  15. {
  16. }
  17. };
  18.  
  19. int main()
  20. {
  21. func<bool,long,long> f;
  22. POINT p { 1,2 };
  23. f( p.x, p.y );
  24. return 0;
  25. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function ‘int main()’:
prog.cpp:23:14: error: no match for call to ‘(func<bool, long int, long int>) (long int&, long int&)’
  f( p.x, p.y );
              ^
prog.cpp:14:4: note: candidate: template<class R, class ... P> R func<RetType, Params>::operator()(P&& ...) [with R = R; P = {P ...}; RetType = bool; Params = {long int, long int}]
  R operator()( P&&... p )
    ^~~~~~~~
prog.cpp:14:4: note:   template argument deduction/substitution failed:
prog.cpp:23:14: note:   couldn't deduce template parameter ‘R’
  f( p.x, p.y );
              ^
stdout
Standard output is empty