26 Mar
2007
26 Mar
'07
6:31 p.m.
Hi! I have small piece of code and I do not know why it is not compiling - proper instantiation of function is not created. It means, why boost::function can not deduct types (code below). The problem is when type U is void. Can any one help me with it? Regards. template < typename T, typename U > void test ( boost::function<T(U)> & f ) { f(); } int f3() { std::cout << "f3(void)" << std::endl; return 3; } void f4() { std::cout << "f4(void)" << std::endl; return;// 4; } int main() { boost::function<int (void)> h = &f3; boost::function<void (void)> i = &f4; test (h); test (i); } -- |\/\/| Seweryn Habdank-Wojewódzki \/\/