0

Template member function

class A { public: template<class T> void foo(T c) { // Do stuff } } A* w; w->foo<NewStuff>(11); --- > not working w->template foo<NewStuff>(11); --- > not working any suggestion please??

13th Sep 2021, 3:09 PM
Eyob
Eyob - avatar
3 Answers
+ 2
"w" is just a pointer which is supposed to point to an object of class A, but you never made it point to an object at first place. A *w = new A; Is what you are missing.
13th Sep 2021, 3:25 PM
Arsenic
Arsenic - avatar
+ 1
It would be much better to provide us with a minimum reproducible example of this error.
14th Sep 2021, 12:41 AM
Arsenic
Arsenic - avatar
0
No, I did that I forget to include it in the question.... sorry!
13th Sep 2021, 5:08 PM
Eyob
Eyob - avatar