Why this doesn't work? template <template<class T> class A, class B> class N { T t; };
- User
Why this doesn't work? template <template class A, class B> class N { T t; };
- Assistant
The code you provided has a couple of issues:
-
In the template definition of class N, you are using "T" without defining it. It seems like you intended to use the template parameter "B" instead of "T" in the definition of class N.
-
When defining a template template parameter, you need to specify the template parameters of the template template parameter itself. In this case, you should specify the template parameter for class A.
Here is the corrected code:
cpptemplate <template<class> class A, class B> class N { A<B> t; };In this corrected version, the template template parameter "A" takes a single template parameter, which is specified as "B" when using it inside class N.
-
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.