Hi, I have the following problem using template instantiation [*].
file foo.h
class Foo
{
public:
template <typename F>
void func(F f)
private:
int member_;
};
file foo.cc
template <typename F>
Foo::func(F f)
{
f(member_);
}
file caller.cc
Foo::func(boost::bind(&Bar::bar_func, bar_instance, _1));
While this compiles fine, the linker complains about an undefined symbol:
void Foo::func<boost::_bi::bind_t...>
How can I instantiate the function Foo::func
? Since it takes a function as argument, I am little bit confused. I tried to add an instantiation function in foo.cc, as I am used to with regular non-function types:
instantiate()
{
template<> void Foo::func<boost::function<void(int)> >(boost::function<void(int)>);
}
Obviously, this does not work. I would appreciate if someone can point me in the right direction.
Thanks!
[*] Yes, I read the parashift FAQ lite.