c++ - How to solve the error: "no matching function for call to ‘bind(<unresolved overloaded function type>" when std::bind is used in a class -
usually, std::bind works in boost::math::tools::bisect(). however, when tried use std::bind in class member functions, there error: " no matching function call ‘bind( "
this 1 member function of class:
double singlecapillarytube::callocationfunctionwithoutangle(const tubegeometry &tg, const fluidproperties &fp, double templocation, double initiallocationvalue, double temptime, const double initialtimepoint) { auto coefficientb = calcoefficientb(tg, fp); auto coefficienta = calcoefficienta(tg, fp); auto coefficientd = calcoefficientd(tg, fp); auto tempvalue = -coefficientb * (templocation - initiallocationvalue) - \ 1./2. * coefficienta * (pow(templocation, 2.) - \ pow(initiallocationvalue, 2.)) - coefficientd * \ (temptime - initialtimepoint); return tempvalue; }
then function used in other member function of class:
void singlecapillarytube::callocationinterfacebisect() { stepresult = boost::math::tools::bisect(std::bind(callocationfunctionwithangle,\ geometry, fluids, _3, initiallocation, \ timepoint, initialtime), 0.0, \ -geometry.length, tol); }
when file compiled, error occurred. me solve problem? much:)
non-static member functions need instance called on. give that, pass this
pointer first argument function. need use full qualified name of function , take address:
std::bind(&singlecapillarytube::callocationfunctionwithangle, this, geometry, fluids, _3, initiallocation, timepoint, initialtime)
also note using _3
binds third positional argument parameter, in case first , second arguments ignored. want _1
in spot.
Comments
Post a Comment