Boost logo

Boost Users :

Subject: Re: [Boost-users] [Range, Container] range of to-be-moved values ?
From: Agustín K-ballo Bergé (kaballo86_at_[hidden])
Date: 2014-02-05 12:48:57


On 05/02/2014 06:49 a.m., John M. Dlugosz wrote:
> Given a boost::container::vector<C> vec;
> I can write vec.push_back(move(value)) for a move-only (non-copyable)
> type C, instead of vec.push_back(value) as usual.
> But what would I write instead of vec.insert(pos,b,e) where (b,e] is a
> range of values?

You would use `move_iterator`s:

     vec.insert(pos, boost::make_move_iterator(b),
boost::make_move_iterator(e));

http://www.boost.org/doc/libs/1_55_0/doc/html/move/move_iterator.html

Regards,

-- 
Agustín K-ballo Bergé.-
http://talesofcpp.fusionfenix.com

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net