Boost logo

Boost Users :

From: gast128 (gast128_at_[hidden])
Date: 2007-06-25 08:00:23


Dear all,

I get a crash when I try to wrap a template function with Boost.Function. I
use VStudio 2003 sp1. But maybe the used syntax is wrong:

#include <boost/function.hpp>

struct SomeClass
{
};

template <typename T>
bool func_template(T* p)
{
    return (p != NULL);
}

void example1()
{
    bool (*pf) (SomeClass*) = &func_template<SomeClass>;
    
    boost::function<bool (SomeClass*)> fc1 = &func_template<SomeClass>;
    boost::function1<bool, SomeClass*> fc2 = &func_template<SomeClass>;
    boost::function<bool (SomeClass*)> fc3 = pf;
    
    fc1(NULL); //crashes
    fc2(NULL); //crashes also
    fc3(NULL); //ok
}

Wkr,
me


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