Boost logo

Boost Users :

From: Seweryn Habdank-Wojewódzki (habdank_at_[hidden])
Date: 2007-03-26 14:31:05


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
 \/\/

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net