E
er
hi,
class Gen{
public:
Gen(double (*fun_)()):fun(fun_){};
private:
double (*fun)();
};
class Op{
public:
Op(){};
double operator()(){return 0.0;};
};
double fun(){return 0.0;};
// i'd like to be able to construct Gen from either a fun ptr (OK,
fine as is) or a function object. the code below is probably
adventurous...any suggestion?
int main(){
Gen gen1(&fun);//ok
Op op;
Gen gen2(
boost::bind(
&Op:perator(),
boost::ref(op)
)
);//error: no matching function for call.//the result from bind does
not match double (*)()
class Gen{
public:
Gen(double (*fun_)()):fun(fun_){};
private:
double (*fun)();
};
class Op{
public:
Op(){};
double operator()(){return 0.0;};
};
double fun(){return 0.0;};
// i'd like to be able to construct Gen from either a fun ptr (OK,
fine as is) or a function object. the code below is probably
adventurous...any suggestion?
int main(){
Gen gen1(&fun);//ok
Op op;
Gen gen2(
boost::bind(
&Op:perator(),
boost::ref(op)
)
);//error: no matching function for call.//the result from bind does
not match double (*)()