|
Boost : |
Subject: Re: [boost] [msm] Review
From: Christophe Henry (christophe.j.henry_at_[hidden])
Date: 2009-11-30 15:03:07
Hi Sebastian,
> I know nothing about MSM and very little about state machines in
> general, but if all states are constructed at SM instantiation time,
> would it be possible to pass the SM constructor a tuple of constructed
> states that are copied/moved into the internal states?
In theory it'd be possible because MSM stores the states in a
fusion::set, which can be constructed from a forward sequence. And
according to the fusion doc, a tuple can be adapted to a forward
sequence. So I suppose it'd work.
The problem would be to find an acceptable syntax because a
msm::back::state_machine already has a templated constructor used to
pass arguments to the front-end, for example:
struct player_ : public msm::front::state_machine_def<player_>
{
player_(int some_value){
}
}
typedef msm::back::state_machine<player_ > player;
player p(3);
So we'd need to pass the tuple as extra argument, the first or the
last one and add a bit of SFINAE to check if this argument is a tuple.
> Would it be worth the effort?
I don't know. It has never been requested so it's hard to know, but I
find the idea quite interesting.
Let's make a quick poll (which I'll shamelessly use as a way to make
the review slightly more alive). Would someone make use of this
feature?
Christophe
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk