[fusion] Instantiating elements of nested sequences

Hi, I want to store boost signals in fusion sequences. This does not work directly, since signals are noncopyable. I figured I could use shared_ptr's of the signals, and all that needs to be done is to iterate through the sequences, instantiate objects, and assign them to the shared_ptr's. These are the structures for the signals: template < typename Element > struct element_signals { typedef boost::signal < void(model const &, Element const &) > event_signal_t; typedef boost::signal < void(model const &, Element const &, std::vector < std::string > const &) > modified_signal_t; typedef boost::fusion::vector < std::tr1::shared_ptr < event_signal_t >, // add std::tr1::shared_ptr < event_signal_t >, // remove std::tr1::shared_ptr < modified_signal_t > // modified > signals_t; typedef boost::fusion::pair < Element, signals_t > signals_pair_t; }; typedef boost::fusion::map < element_signals < vertex_iterator > ::signals_pair_t, element_signals < edge_iterator > ::signals_pair_t > signals_t; Now, I am trying to do something like this pseudo-code: signals_t signals; for_each(signals, for_each(_1, _1 = typeof(_1)(new typeof(_1)::element_type) ) ); Problems: 1) How do I get the type of the current element in the for_each loop without resorting to functors? 2) I tried to use a MPL placeholder for the _1 in the outer for_each loop, but it didn't seem to work. Does Fusion have its own placeholders, or what am I missing? Regards,
participants (1)
-
Carlos Rafael Giani