|
Boost Users : |
Subject: Re: [Boost-users] Separating templatized on_entry/on_exit into cpp/h
From: Christophe Henry (christophe.j.henry_at_[hidden])
Date: 2012-04-19 15:43:38
Sorry for my late answer, I overlooked this message :(
>Hello,
>
>I'm trying to modify the Player example and to separate the on_exit/on_entry template function definition from declaration so I can hide
>the actual implementation details.
>
>"My.h"
>...
>namespace myNamespace
>{
>...
>// Concrete FSM implementation
>struct player_state_machine : public msm::front::state_machine_def<player_state_machine>
>{
>...
>struct Playing : msm::front::state<>
>{
>template <class Event, class player_state_machine >
>void on_entry(event const &, player_state_machine & ); // { "My Secret Code }
>}
>......
>}
>}
>
>
>"My.cpp"
>
>namespace myNamespace
>{
>...
>template <class Event, class player_state_machine >
>void myNamespace::player_state_machine::Playing::on_entry(Event const &, player_state_machine & );
>{
>Here I want to put the actual implementation...
>}
>
>
>Is this feasible ?
I'm afraid no.
>If not - what are the alternatives ? As I previously said - putting the implementation into the header is not an option.
You could forward the on_entry call to a non-template method of Playing (or several overloaded non-template methods) which you only declare in your header and implement in a cpp. The state itself is usually not a template class.
>Any help will be appreciated.
>
>Evgeni
HTH,
Christophe
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net