Skip to content

Commit 3184620

Browse files
author
Dawn Perchik
committed
LWG2783 stack::emplace() and queue::emplace() should return decltype(auto)
1 parent 498c264 commit 3184620

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

source/containers.tex

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9285,7 +9285,8 @@
92859285
void push(const value_type& x) { c.push_back(x); }
92869286
void push(value_type&& x) { c.push_back(std::move(x)); }
92879287
template <class... Args>
9288-
reference emplace(Args&&... args) { return c.emplace_back(std::forward<Args>(args)...); }
9288+
decltype(auto) emplace(Args&&... args)
9289+
{ return c.emplace_back(std::forward<Args>(args)...); }
92899290
void pop() { c.pop_front(); }
92909291
void swap(queue& q) noexcept(is_nothrow_swappable_v<Container>)
92919292
{ using std::swap; swap(c, q.c); }
@@ -9841,7 +9842,8 @@
98419842
void push(const value_type& x) { c.push_back(x); }
98429843
void push(value_type&& x) { c.push_back(std::move(x)); }
98439844
template <class... Args>
9844-
reference emplace(Args&&... args) { return c.emplace_back(std::forward<Args>(args)...); }
9845+
decltype(auto) emplace(Args&&... args)
9846+
{ return c.emplace_back(std::forward<Args>(args)...); }
98459847
void pop() { c.pop_back(); }
98469848
void swap(stack& s) noexcept(is_nothrow_swappable_v<Container>)
98479849
{ using std::swap; swap(c, s.c); }

0 commit comments

Comments
 (0)