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

  • SEARCH
  • Home
  • 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 6811493
In Process

The Archive Base Latest Questions

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

I have a state A that I would like to transition to its next

  • 0

I have a state A that I would like to transition to its next state B unconditionally, once the constructor of A has completed. Is this possible?

I tried posting an event from the constructor, which does not work, even though it compiles. Thanks.

Edit: Here is what I’ve tried so far:

struct A : sc::simple_state< A, Active >
{
    public:
        typedef sc::custom_reaction< EventDoneA > reactions;
        A()
        {
            std::cout << "Inside of A()" << std::endl;
            post_event( EventDoneA() );
        }

        sc::result react( const EventDoneA & )
        {
            return transit< B >();
        }
};

This yields the following runtime assertion failure:

Assertion failed: get_pointer( pContext_ ) != 0, file /includ
e/boost/statechart/simple_state.hpp, line 459
  • 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-26T20:20:06+00:00Added an answer on May 26, 2026 at 8:20 pm

    I’ve updated my OP with my solution, here it is so I can close the question.

    The problem is that you cannot inherit from simple_state to achieve the desired transition, you must inherit from state, which then requires that you modify the constructor accordingly.

    struct A : sc::state< A, Active >
    {
        public:
            typedef sc::custom_reaction< EventDoneA > reactions;
            A( my_context ctx ) : my_base( ctx )
            {
                std::cout << "Inside of A()" << std::endl;
                post_event( EventDoneA() );
            }
    
            sc::result react( const EventDoneA & )
            {
                return transit< B >();
            }
    };
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a transition. I would like to say that if the last transition
I have some fairly simple state needs (for now). I think I would like
I would like to have a function that would return the best a multidimension
I have a class that I would like to expose through a Jersey RESTful
First of all, i have to state that i am new to Java in
I have a State class that includes configuration as well as some state-specific methods.
I have state data in a txt file that I used to seed my
I state that I am a complete beginner to LDAP. I have to let
Before I ask the question let me state that I have attempted to google
basically i have (state, state code) pairs, that are subsets of country [USA] ->

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.