在增强转移机中组合多个警卫
Combining Multiple Guards in Boost Metastate Machine
是否有一种方法可以在Boost Meta状态机的函数前端组合多个后卫?
我想做以下操作:
struct transition_table : mpl::vector<
// Start Event Target Action Guard
// +---------+------------+-----------+---------------------------+----------------------------+
Row < Stopped , play , Playing , start_playback , guard1 && guard2 >
// +---------+------------+-----------+---------------------------+----------------------------+
> {};
guard1
和guard2
都是布尔表达式。但是,这不会编译。Boost SML可以轻松允许。
使用以下代码:
struct actions_guards {
auto operator()() noexcept {
using namespace sml;
return make_transition_table(
*"idle"_s + event<e1> = "s1"_s
, "s1"_s + event<e2> [ guard1 && guard2 ] / action1 = X
);
}
#include <boost/msm/front/euml/euml.hpp>
using namespace euml;
struct transition_table : mpl::vector<
// Start Event Target Action Guard
// +---------+------------+-----------+---------------------------+----------------------------+
Row < Stopped , play , Playing , start_playback , And_<guard1, guard2> >
// +---------+------------+-----------+---------------------------+----------------------------+
> {};
相关文章:
- 如何在OMNET++中指定与命令行参数组合的输出文件名
- 无法将结构注册为增强几何体3D点
- 可组合的lambda/std::函数与std::可选
- 如何将两个不同矢量的同一位置的两个元素组合在一起
- 混合组合和继承的C++问题
- 我需要将多个函数组合为一个函数
- 构建可组合有向图(扫描仪生成器的汤普森构造算法)
- 通过组合不同的类型来创建唯一的id
- 用常见虚拟函数实现的任意组合来实现派生类的正确方法是什么
- 模板元编程:如何将参数包组合成新的参数包
- 检查向量是否具有所有可能的字符组合
- 增强基于 XML class_id的反序列化
- 如何在加密++中将两个源组合成新的源
- 根中的组合
- 增强精神解析器规则以检测语句中的特殊结尾
- C++ 使用增强正则表达式库时断言崩溃
- 增强精神 X3:错误:在"..."中没有名为"大小"的类型
- 更改 C++ 中的组合分类变量
- 错误:(-210:不支持的格式或格式组合)功能'create'中的硬件视频解码器不支持视频源
- 在增强转移机中组合多个警卫