fork download
  1. #include <iostream>
  2. #include <tuple>
  3.  
  4. template<typename... Ts>
  5. struct base
  6. {
  7. std::tuple<Ts...> tuple;
  8. };
  9.  
  10. template<typename... Ts>
  11. struct deriv : base<Ts...>
  12. {
  13. };
  14.  
  15. //--------------------------------
  16.  
  17. template<typename T>
  18. void func(const T&)
  19. {
  20. std::cout << "T" << std::endl;
  21. }
  22.  
  23. template<typename... Ts>
  24. void func(const base<Ts...>&)
  25. {
  26. std::cout << "base<Ts...>" << std::endl;
  27. }
  28.  
  29. //----------------------------------------
  30.  
  31. int main()
  32. {
  33. int a;
  34. base <int, double> b;
  35. deriv<int, double> c;
  36.  
  37. func(a);
  38. func(b);
  39. func(static_cast<base<int, double> &>(c)); // <--- I want func<base<Ts...>> not func<T> to be called here
  40.  
  41. exit(0);
  42. }
Success #stdin #stdout 0s 2852KB
stdin
Standard input is empty
stdout
T
base<Ts...>
base<Ts...>