Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6878397
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T04:43:07+00:00 2026-05-27T04:43:07+00:00

I’ve had problems with this before but now it’s somehow working. Now I’ve following

  • 0

I’ve had problems with this before but now it’s somehow working.

Now I’ve following problem. I need to bind values into member-function before I call boost::bisect with the same function. I found pretty good tutorial and I’ve followed it but it seems that I’m still doing something wrong.

At first I created test class where I got following working:

std::pair<double, double> result = bisect(&Func, 0.0, 1.0, TerminationCondition());
            double root = (result.first + result.second) / 2;

After that I added binding “on the fly as I thought it could work”

 std::pair<double, double> result = bisect(boost::bind(&CLASS::Function,this, _1), 0.0, 1.000000, TerminationCondition());

Result of that was an error. error: terminate called after throwing an instance of ‘boost::exception_detail::clone_impl >’ what(): Error in function boost::math::tools::bisect: No change of sign in boost::math::tools::bisect, either there is no root to find, or there are multiple roots in the interval (f(min) = -0.0032916729090909091).

Anyway here is class::function which doesn’t work as member function with binding for some reason. I tested it as non-member and it works

double CLASS::Function(double c)
{
/* values: m_a, m_b, m_c, m_d, and m_minus are located in .h file */

normal norm;
double temp = m_d*sqrt(c);

double total = ((1-boost::math::pdf(norm,(m_a*c+m_b)/temp))-(1 - m_c)+boost::math::pdf(norm,(m_a*c+m_b)/temp));

return (total - m_minus); 
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T04:43:07+00:00Added an answer on May 27, 2026 at 4:43 am

    If I read the tutorial correctly, it should be:

    std::pair<double, double> result =
        bisect(boost::bind(&CLASS::Function, this, _1, _2, _3),
            0.0, 1.000000, TerminationCondition());
    

    I.e. the parameters to boost::bind() are:

    1. The name of the function (object) to bind to
    2. the arguments to pass to that, as the function expects them

    For your case, a CLASS::memberFunc(), that’d be a CLASS * (possibly this but any CLASS * is ok) as the first, which you literally state as such, followed by the parameters later passed to the bound object.

    These “futures” are designated by _1, _2 and so on, depending on their position at invocation time.

    Example:

    class addthree {
    private:
        int second;
    public:
        addthree(int term2nd = 0) : second(term2nd) {}
        void addto(int &term1st, const int constval) {
            term1st += (term2nd + constval);
        }
    }
    
    int a;
    addthree aa;
    boost::function<void(int)> add_to_a = boost::bind(&addthree::addto, &aa, a, _1);
    boost::function<void(void)> inc_a = boost::bind(&addthree::addto, &aa, a, 1);
    
    a = 0 ; add_to_a(2); std::cout << a << std::endl;
    a = 10; add_to_a(a); std::cout << a << std::endl;
    a = 0 ; inc_a(); std::cout << a << std::endl;
    [ ... ]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

this is what i have right now Drawing an RSS feed into the php,
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a French site that I want to parse, but am running into
I am currently running into a problem where an element is coming back from
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I need to clean up various Word 'smart' characters in user input, including but
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I want to count how many characters a certain string has in PHP, but
For some reason, after submitting a string like this Jack’s Spindle from a text

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.