I have solve the problem.
I missing terminate function.
Modify source file
int main(int argc, char* argv[])
{
Human human;
human.initiate();
+ human.terminate();
return 0;
}
----- Original Message -----
From: Jiang Miao
Newsgroups: gmane.comp.lib.boost.user
To: boost-users@lists.boost.org
Sent: Tuesday, July 24, 2007 4:04 PM
Subject: [statechart] context<>() assert failed in destructorfunction in VC8.0
I wrote a simple code.
source file:
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include <iostream>
#include <string>
using namespace std;
namespace sc=boost::statechart;
namespace mpl=boost::mpl;
struct EvtEat:sc::event<EvtEat>{};
struct EvtStop:sc::event<EvtStop>{};
struct Eating;
struct Idle;
class Human:public sc::state_machine< Human, Idle >
{
public:
void show(void)
{
cout<<__FUNCTION__<
{
Idle(my_context ctx):my_base(ctx)
{
context<Human>().show(); //ok
};
~Idle(void)
{
context<Human>().show(); //assert failed
};
};
struct Eating:sc::state< Eating, Human >
{
Eating(my_context ctx):my_base(ctx)
{
};
~Eating(void)
{
context<Human>();
}
};
int main(int argc, char* argv[])
{
Human human;
human.initiate();
return 0;
}
/*
In debug mode.It output
Human::show
Assertion failed: dynamic_cast<Target>(x) == x, file p:\programme\libs\boost\include\boost-1_35\boost\cast.hpp, line 97
*/
Why does it assert failed and how to modify the source?
Thank you.
------------------------------------------------------------------------------
_______________________________________________
Boost-users mailing list
Boost-users@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users