BOOST_TYPE_ERASURE_MEMBER((has_process_event), process_event, 1)
typedef any<has_process_event<HandledEnum(Event1 const &)>, _self&> any_fsm;
struct AnyFSM
{
AnyFSM(any_fsm afsm_) : _afsm(afsm_) {}
void process(Event1& e) { _afsm.process_event(e); }
any_fsm _afsm;
};
test.cpp:47:43: error: 'Event1' does not refer to a value
typedef any<has_process_event<HandledEnum(Event1 const &)>, _self&> any_fsm;
BOOST_TYPE_ERASURE_MEMBER((has_push_back), push_back, 1)
typedef any<has_push_back<void(int)>, _self&> any_container;
void append_many(any_container container) {
for(int i = 0; i < 10; ++i)
container.push_back(i);
}
struct AnyContainer
{
AnyContainer(any_container cont_) : _cont(cont_) {}
void append() {append_many(_cont); }
any_container _cont;
};
AnyContainer m(v);
m.append();
for(auto i : v)
{
std::cout << i << std::endl;
}
Thanks
-Raj