refering to objects when constructing a boost::fusion::vector
Hi list: I'm in the process of using boost::fusion::vector, with the following definition: typedef boost::fusion::vector<PmStream*, MIDIInputThread, boost::shared_ptr<boost::asio::io_service>, boost::shared_ptr<boost::thread> > InputType; I'm then constructing this using the following code: PmStream* Port; MIDIInputThread cl; InputType NewInput =InputType(Port, cl, boost::make_shared<boost::asio::io_service>, boost::make_shared<boost::thread>(boost::bind(&boost::asio::io_service::run, io.get()))); What I'm wondering is is there a way to refer to a previously declared argument in this case, I'd like to refer to the shared pointer containing the boost::asio::io_service. Given that I've not actually named this argument, could I use anything from either boost.fusion or boost.mpl to do what I require. Any help appreciated. Regards Sean.
On Mon, Mar 21, 2011 at 12:51 PM, Sean Farrow <sean.farrow@seanfarrow.co.uk>wrote:
Hi list:
I’m in the process of using boost::fusion::vector, with the following definition:
typedef boost::fusion::vector<PmStream*, MIDIInputThread, boost::shared_ptr<boost::asio::io_service>, boost::shared_ptr<boost::thread>
InputType;
I’m then constructing this using the following code:
PmStream* Port;
MIDIInputThread cl;
InputType NewInput =InputType(Port, cl, boost::make_shared<boost::asio::io_service>, boost::make_shared<boost::thread>(boost::bind(&boost::asio::io_service::run, io.get())));
What I’m wondering is is there a way to refer to a previously declared argument in this case, I’d like to refer to the shared pointer containing the boost::asio::io_service. Given that I’ve not actually named this argument, could I use anything from either boost.fusion or boost.mpl to do what I require.
Any help appreciated.
Regards
Sean.
How about something like mpl::at_c<InputType, 1> ? (I daresay they'll be a proper expert along in a while!) - Rob.
I’m in the process of using boost::fusion::vector, with the following definition:
typedef boost::fusion::vector<PmStream*, MIDIInputThread, boost::shared_ptr<boost::asio::io_service>, boost::shared_ptr<boost::thread>
InputType;
I’m then constructing this using the following code:
PmStream* Port;
MIDIInputThread cl;
InputType NewInput =InputType(Port, cl, boost::make_shared<boost::asio::io_service>, boost::make_shared<boost::thread>(boost::bind(&boost::asio::io_service::run, io.get())));
What I’m wondering is is there a way to refer to a previously declared argument in this case, I’d like to refer to the shared pointer containing the boost::asio::io_service.
#include <boost/fusion/include/at_c.hpp> at_c<2>(NewInput)
participants (3)
-
Igor R
-
Robert Jones
-
Sean Farrow