在使用 Boost.Statechart 实现状态机时,我遇到了一个问题,原因是尝试simple_state
从其构造函数访问 a 的外部上下文。中的一条评论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<>
作为我的状态的基类有什么区别或影响?