Boost logo

Boost Users :

From: Josef Grahn (josef.grahn_at_[hidden])
Date: 2007-08-23 07:48:24


Hello,

I encountered the following inconsistency constructing a boost::function
object from a pointer to a template function.

template <typename T> void foo(T) {}

int main(int argc, char **argv) {
    boost::function<void (int)> f1;
    f1 = foo<int>;
    boost::function<void (int)> f2 = foo<int>;

    f1(0); // ok
    f2(0); // error, function pointer is zero!

    return 0;
}

I am compiling on MSVC2005 SP1, using boost version 1.34.1. It seems to
work properly with GCC 4.1.2 and boost 1.33.1 on Ubuntu, however.

Is this a known problem?

Best Regards,

Josef Grahn


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