Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Opposite of emplace

50 views
Skip to first unread message

Marcel Mueller

unread,
Oct 30, 2014, 9:16:09 PM10/30/14
to
With C++11 the standard containers like vector, deque etc. got a new
function emplace to construct new objects in place. Very useful, from my
point of view. I almost do not use anything else anymore.

But what about the other direction? How to remove objects with move
semantics? pop_back does not return anything, and there is no new
function which returns an rvalue reference. Did I miss something?


Marcel

Paavo Helde

unread,
Oct 31, 2014, 12:08:13 AM10/31/14
to
Marcel Mueller <news.5...@spamgourmet.org> wrote in news:m2uns8$ohk$1
@gwaiyur.mb-net.net:
std::move()?

woodb...@gmail.com

unread,
Oct 31, 2014, 12:24:42 AM10/31/14
to
Maybe use ::std::move on back() and then call pop_back().


Brian
Ebenezer Enterprises - In G-d we trust.
http://webEbenezer.net

JiiPee

unread,
Oct 31, 2014, 8:12:34 AM10/31/14
to
Yes it sounds logical the libraries should work this way. Or maybe they
should have a new method:

move_back which moves the object to caller :). But then too many member
in class maybe :)
0 new messages