fork download
  1. #include <functional>
  2. using namespace std;
  3.  
  4. /* a function template */
  5. template <typename A, typename B>
  6. A f(B) { return A(); }
  7.  
  8. /* a class template */
  9. template <typename A, typename B>
  10. class X {};
  11.  
  12. template <typename A, typename B>
  13. class Y
  14. {
  15. /** All these constructors fail to compile **/
  16.  
  17. Y(X<A,B> = X<A,B>())
  18. //Y(A (*arg)(B) = f<A, B>)
  19. //Y(std::function<A(B)> arg = f<A, B>)
  20. { }
  21. };
  22.  
  23. int main()
  24. { return 0; }
Success #stdin #stdout 0s 2848KB
stdin
Standard input is empty
stdout
Standard output is empty