Title
Container adaptors push
Status
resolved
Section
[container.adaptors]
Submitter
Paolo Carlini

Created on 2007-10-31.00:00:00 last changed 163 months ago

Messages

Date: 2010-10-21.18:28:33
Date: 2010-10-21.18:28:33

Proposed resolution:

Change [queue.defn]:

void push(const value_type& x) { c.push_back(x); }
void push(value_type&& x) { c.push_back(std::move(x)); }
template<class... Args> void push(Args&&... args) { c.push_back(std::forward<Args>(args)...); }

Change [priority.queue]:

void push(const value_type& x) { c.push_back(x); }
void push(value_type&& x) { c.push_back(std::move(x)); }
template<class... Args> void push(Args&&... args) { c.push_back(std::forward<Args>(args)...); }

Change [priqueue.members]:

void push(const value_type& x);

Effects:

c.push_back(x);
push_heap(c.begin(), c.end(), comp);
template<class... Args> void push(value_type Args&&... x args);

Effects:

c.push_back(std::moveforward<Args>(x args)...);
push_heap(c.begin(), c.end(), comp);

Change [stack.defn]:

void push(const value_type& x) { c.push_back(x); }
void push(value_type&& x) { c.push_back(std::move(x)); }
template<class... Args> void push(Args&&... args) { c.push_back(std::forward<Args>(args)...); }
Date: 2010-10-21.18:28:33

[ Related to 767 ]

Date: 2007-10-31.00:00:00

After n2369 we have a single push_back overload in the sequence containers, of the "emplace" type. At variance with that, still in n2461, we have two separate overloads, the C++03 one + one taking an rvalue reference in the container adaptors. Therefore, simply from a consistency point of view, I was wondering whether the container adaptors should be aligned with the specifications of the sequence container themselves: thus have a single push along the lines:

template<typename... _Args>
void
push(_Args&&... __args)
  { c.push_back(std::forward<_Args>(__args)...); }
History
Date User Action Args
2010-12-05 14:14:49adminsetstatus: nad editorial -> resolved
2010-10-21 18:28:33adminsetmessages: + msg3667
2010-10-21 18:28:33adminsetmessages: + msg3666
2010-10-21 18:28:33adminsetmessages: + msg3665
2007-10-31 00:00:00admincreate