G
Gawain
Hi Guys,
I am trying to call a template function in a template class like
below, but compiling error occured. Do anyone know how to solve it?
thanks.
class A {
public:
template<bool b> void foo() {; }
};
template<class T >
class B {
public:
void foo() {
T t;
t.foo<false> (); // error occured here.
}
};
main()
{
B<A> val;
val.foo();
}
Error details:
==============================================
Test.cpp: In member function `void B<T>::foo()':
Test.cpp:26: error: expected primary-expression before ')' token
Test.cpp: In member function `void B<T>::foo() [with T = A]':
Test.cpp:33: instantiated from here
Test.cpp:26: error: invalid use of member (did you forget the `&' ?)
I am trying to call a template function in a template class like
below, but compiling error occured. Do anyone know how to solve it?
thanks.
class A {
public:
template<bool b> void foo() {; }
};
template<class T >
class B {
public:
void foo() {
T t;
t.foo<false> (); // error occured here.
}
};
main()
{
B<A> val;
val.foo();
}
Error details:
==============================================
Test.cpp: In member function `void B<T>::foo()':
Test.cpp:26: error: expected primary-expression before ')' token
Test.cpp: In member function `void B<T>::foo() [with T = A]':
Test.cpp:33: instantiated from here
Test.cpp:26: error: invalid use of member (did you forget the `&' ?)