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 6751537
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T12:56:20+00:00 2026-05-26T12:56:20+00:00

Why might using the following fail unless called from the constructor of the class?

  • 0

Why might using the following fail unless called from the constructor of the class?

    updateState = boost::bind( &PhysicsObject::updateActive, this );

However the following fails at runtime, with a ‘what(): call to empty boost::function’ exception

void PhysicsObject::setState( PhsyicsObjectState aState ) {
_state = aState;

if( _state == ACTIVE ) { // This branch is executed
    updateState = boost::bind( &PhysicsObject::updateActive, this );
} else {
    updateState = boost::bind( &PhysicsObject::updateExploding, *this );
}
}
  • 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-26T12:56:21+00:00Added an answer on May 26, 2026 at 12:56 pm

    Calling a boost::function that wasn’t set would raise such exception. You should initialize it in your constructor according to the default “state”, otherwise your setState won’t set it if passed a state same as the current.

    Note that in your second bind, you are passing a copy of the object pointed by this.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

What might be the possible cause of the following? I am using an autocomplete
What might be the best way to start programming using boost lambda libraries.
I'm using the MessageBox class to show errors to users, and while that might
Why might the following grant statement fail to work? grant all on kylie.* to
Im using the following code: {foreach from=$entries key=i item=topic} {if $topic.topic_style == problem} <li>
I'm using the following code to try to read an input from user and
How might I sort the following using PHP? (where wed_2_open comes after wed_1_close) I
Using the following query: SELECT pe.prodtree_element_name_l, MAX(rs.resource_value) AS resource_value FROM prodtree_element pe LEFT JOIN
I am using the following code to download a bitmap from a url,: myFileUrl
I'm using the following statement SELECT TOP 5 rootcause, COUNT(IIF(accountability=Team 1,1,0)) FROM MOAQ WHERE

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.