This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Patch]New feature to all kind of stl container.vector::data_move() returns vector::data() that can be moved,just as unique_ptr::release() to unique_ptr::get()


On Thu, 8 Jan 2015, éååå wrote:

If this don't interest you because vector is used widely,let's look at stringstream,since no one will forget to convert it to a string when it has finished it's job:
stringstream ss;
for(int i=0;i<10000000;++i)ss<<i<<' ';
setString(ss.str());//you can't save this heavy copy in ss.str()
setString(ss.str_move());don't have to leave the heap memory of ss for fear that ss's destructor will loss its job

This should be spelled:
std::move(ss).str()

--
Marc Glisse


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]