This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of Resolved status.

### 756. Container adaptors push

Section: 24.6 [container.adaptors] Status: Resolved Submitter: Paolo Carlini Opened: 2007-10-31 Last modified: 2016-01-28

Priority: Not Prioritized

View all other issues in [container.adaptors].

View all issues with Resolved status.

Discussion:

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)...); }

[ Related to 767 ]

Proposed resolution:

Change 24.6.6.1 [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 24.6.7 [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 24.6.7.4 [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 24.6.8.2 [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)...); }

Rationale:

Addressed by N2680 Proposed Wording for Placement Insert (Revision 1).