Boost logo

Boost :

Subject: [boost] [bind] Move Parameters?
From: Daniel Larimer (dlarimer_at_[hidden])
Date: 2012-06-04 20:31:33


Say I have some synchronous code like this:
        vector<data> v;
        some_method( std::move(v) )

Now I want to call to make that some_method call asynchronous so what I really want is

        function<void()> f = bind( some_method, boost::rref( std::move(v) ) )
        
        asio_io_service.post(f); // performs async move of v into some_method
        asio_io_service.post(f); // undefined, or throw bound parameter has already moved...
        
As far as I can tell there is no current support for anything like this, and I think it could be very useful.

Dan


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk