
AMDG Surya Kiran Gullapalli wrote:
If you can use compile time constants instead of runtime values, you can use indices into a fusion::vector.
The SignalId I'm talking about is a compile time constant (an enum) I'm trying this, but could not get anywhere for the past few days. Any pointers on this ?
#include <boost/fusion/include/vector.hpp> #include <boost/fusion/include/at.hpp> class A { private: typedef boost::fusion::vector< boost::signal<void()>, boost::signal<void (const string&)> > signals_type; signals_type m_signals; public: static const int VoidSignal = 0; static const int StringSignal = 1; template<int ID> typename boost::fusion::result_of::at_c<signals_type, ID>::type getSignal() { return boost::fusion::at_c<ID>(m_signals); } }; void f() { A a; a.getSignal<A::VoidSignal>() } In Christ, Steven Watanabe