在 Boost.Statechart 中,state 和 simple_state 有什么区别?
In Boost.Statechart, what's the difference between state and simple_state?
在使用Boost实现状态机时。在Statechart中,我遇到了一个问题,这个问题是由于试图从simple_state
的构造函数访问它的外部上下文而引起的。simple_state.hpp
中的一条评论告诉我:
// This assert fails when an attempt is made to access an outer
// context from a constructor of a state that is *not* a subtype of
// state<>. To correct this, derive from state<> instead of
// simple_state<>.
除了能够从构造函数访问外部上下文之外,使用state<>
而不是simple_state<>
作为我的状态的基类还有什么区别或含义?
从一个状态可以做许多其他事情<>无法从simple_state<>执行的派生构造函数派生构造函数。文档中有一个状态类的列表。我发现发布活动是从状态<>中获得的巨大好处。
我已经有一段时间没有使用它了,但我不记得有任何含义,除了你必须为从state派生的每个类实现转发构造函数(在文档中说明),如state<>从simple_state<>派生。
相关文章:
- 为不同配置设置MSVC_RUNTIME_LIBRARY的正确方法是什么
- 警告处理为错误这里有什么问题
- 什么时候调用组成单元对象的析构函数
- #定义c-预处理器常量..我做错了什么
- 努力将整数转换为链表。不知道我在这里做错了什么
- C++我的数学有什么问题,为什么我的代码不能正确循环
- 什么时候在C++中返回常量引用是个好主意
- 当在同一名称空间中有两个具有相同签名的函数时,会发生什么
- C++避免重复声明的语法是什么
- c++库的公共头文件中应该包含什么
- 问题:什么是QAbstractItemView::NoEditTriggers的反面
- 有什么方法可以遍历结构吗
- 当类在C++中定义时,有什么方法可以"register"类吗?
- ifstream什么都没读
- 在C++中,将大的无符号浮点数四舍五入为整数的最佳方法是什么
- 实现无开销push_back的最佳方法是什么
- C++从另一个类访问公共静态向量的正确方法是什么
- "throw expression code" 1e7 >返回 d 是什么?投掷标准::overflow_error( "too big" ) : d;意味 着?
- C++ 中的'retain state'是什么意思?
- 在 Boost.Statechart 中,state 和 simple_state 有什么区别?