Index: include/debug/vector =================================================================== --- include/debug/vector (revision 136738) +++ include/debug/vector (working copy) @@ -289,7 +289,6 @@ using _Base::data; // 23.2.4.3 modifiers: -#ifndef __GXX_EXPERIMENTAL_CXX0X__ void push_back(const _Tp& __x) { @@ -299,13 +298,18 @@ this->_M_invalidate_all(); _M_update_guaranteed_capacity(); } -#else + +#ifdef __GXX_EXPERIMENTAL_CXX0X__ + void + push_back(_Tp&& __x) + { emplace_back(std::move(__x)); } + template void - push_back(_Args&&... __args) + emplace_back(_Args&&... __args) { bool __realloc = _M_requires_reallocation(this->size() + 1); - _Base::push_back(std::forward<_Args>(__args)...); + _Base::emplace_back(std::forward<_Args>(__args)...); if (__realloc) this->_M_invalidate_all(); _M_update_guaranteed_capacity(); Index: include/debug/deque =================================================================== --- include/debug/deque (revision 136738) +++ include/debug/deque (working copy) @@ -1,6 +1,6 @@ // Debugging deque implementation -*- C++ -*- -// Copyright (C) 2003, 2004, 2005, 2006, 2007 +// Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 // Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free @@ -254,7 +254,6 @@ } // 23.2.1.3 modifiers: -#ifndef __GXX_EXPERIMENTAL_CXX0X__ void push_front(const _Tp& __x) { @@ -268,20 +267,29 @@ _Base::push_back(__x); this->_M_invalidate_all(); } -#else + +#ifdef __GXX_EXPERIMENTAL_CXX0X__ + void + push_front(_Tp&& __x) + { emplace_front(std::move(__x)); } + + void + push_back(_Tp&& __x) + { emplace_back(std::move(__x)); } + template void - push_front(_Args&&... __args) + emplace_front(_Args&&... __args) { - _Base::push_front(std::forward<_Args>(__args)...); + _Base::emplace_front(std::forward<_Args>(__args)...); this->_M_invalidate_all(); } template void - push_back(_Args&&... __args) + emplace_back(_Args&&... __args) { - _Base::push_back(std::forward<_Args>(__args)...); + _Base::emplace_back(std::forward<_Args>(__args)...); this->_M_invalidate_all(); } Index: include/debug/list =================================================================== --- include/debug/list (revision 136738) +++ include/debug/list (working copy) @@ -280,6 +280,10 @@ // 23.2.2.3 modifiers: using _Base::push_front; +#ifdef __GXX_EXPERIMENTAL_CXX0X__ + using _Base::emplace_front; +#endif + void pop_front() { @@ -291,6 +295,10 @@ using _Base::push_back; +#ifdef __GXX_EXPERIMENTAL_CXX0X__ + using _Base::emplace_back; +#endif + void pop_back() { Index: include/bits/stl_list.h =================================================================== --- include/bits/stl_list.h (revision 136738) +++ include/bits/stl_list.h (working copy) @@ -833,15 +833,19 @@ * done in constant time, and does not invalidate iterators and * references. */ -#ifndef __GXX_EXPERIMENTAL_CXX0X__ void push_front(const value_type& __x) { this->_M_insert(begin(), __x); } -#else + +#ifdef __GXX_EXPERIMENTAL_CXX0X__ + void + push_front(value_type&& __x) + { this->_M_insert(begin(), std::move(__x)); } + template void - push_front(_Args&&... __args) - { this->_M_insert(begin(), std::forward<_Args>(__args)...); } + emplace_front(_Args&&... __args) + { this->_M_insert(begin(), std::forward<_Args>(__args)...); } #endif /** @@ -870,15 +874,19 @@ * in constant time, and does not invalidate iterators and * references. */ -#ifndef __GXX_EXPERIMENTAL_CXX0X__ void push_back(const value_type& __x) { this->_M_insert(end(), __x); } -#else + +#ifdef __GXX_EXPERIMENTAL_CXX0X__ + void + push_back(value_type&& __x) + { this->_M_insert(end(), std::move(__x)); } + template void - push_back(_Args&&... __args) - { this->_M_insert(end(), std::forward<_Args>(__args)...); } + emplace_back(_Args&&... __args) + { this->_M_insert(end(), std::forward<_Args>(__args)...); } #endif /** Index: include/bits/stl_queue.h =================================================================== --- include/bits/stl_queue.h (revision 136738) +++ include/bits/stl_queue.h (working copy) @@ -1,6 +1,6 @@ // Queue implementation -*- C++ -*- -// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007 +// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 // Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free @@ -220,16 +220,19 @@ * to it. The time complexity of the operation depends on the * underlying sequence. */ -#ifndef __GXX_EXPERIMENTAL_CXX0X__ void push(const value_type& __x) { c.push_back(__x); } -#else - // NB: DR 756. + +#ifdef __GXX_EXPERIMENTAL_CXX0X__ + void + push(value_type&& __x) + { c.push_back(std::move(__x)); } + template void - push(_Args&&... __args) - { c.push_back(std::forward<_Args>(__args)...); } + emplace(_Args&&... __args) + { c.emplace_back(std::forward<_Args>(__args)...); } #endif /** @@ -509,20 +512,26 @@ * The time complexity of the operation depends on the underlying * sequence. */ -#ifndef __GXX_EXPERIMENTAL_CXX0X__ void push(const value_type& __x) { c.push_back(__x); std::push_heap(c.begin(), c.end(), comp); } -#else - // NB: DR 756. + +#ifdef __GXX_EXPERIMENTAL_CXX0X__ + void + push(value_type&& __x) + { + c.push_back(std::move(__x)); + std::push_heap(c.begin(), c.end(), comp); + } + template void - push(_Args&&... __args) - { - c.push_back(std::forward<_Args>(__args)...); + emplace(_Args&&... __args) + { + c.emplace_back(std::forward<_Args>(__args)...); std::push_heap(c.begin(), c.end(), comp); } #endif Index: include/bits/stl_stack.h =================================================================== --- include/bits/stl_stack.h (revision 136738) +++ include/bits/stl_stack.h (working copy) @@ -1,6 +1,6 @@ // Stack implementation -*- C++ -*- -// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007 +// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 // Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free @@ -184,16 +184,19 @@ * to it. The time complexity of the operation depends on the * underlying sequence. */ -#ifndef __GXX_EXPERIMENTAL_CXX0X__ void push(const value_type& __x) { c.push_back(__x); } -#else - // NB: DR 756. + +#ifdef __GXX_EXPERIMENTAL_CXX0X__ + void + push(value_type&& __x) + { c.push_back(std::move(__x)); } + template void - push(_Args&&... __args) - { c.push_back(std::forward<_Args>(__args)...); } + emplace(_Args&&... __args) + { c.emplace_back(std::forward<_Args>(__args)...); } #endif /** Index: include/bits/stl_vector.h =================================================================== --- include/bits/stl_vector.h (revision 136738) +++ include/bits/stl_vector.h (working copy) @@ -681,7 +681,6 @@ * done in constant time if the %vector has preallocated space * available. */ -#ifndef __GXX_EXPERIMENTAL_CXX0X__ void push_back(const value_type& __x) { @@ -693,20 +692,15 @@ else _M_insert_aux(end(), __x); } -#else + +#ifdef __GXX_EXPERIMENTAL_CXX0X__ + void + push_back(value_type&& __x) + { emplace_back(std::move(__x)); } + template void - push_back(_Args&&... __args) - { - if (this->_M_impl._M_finish != this->_M_impl._M_end_of_storage) - { - this->_M_impl.construct(this->_M_impl._M_finish, - std::forward<_Args>(__args)...); - ++this->_M_impl._M_finish; - } - else - _M_insert_aux(end(), std::forward<_Args>(__args)...); - } + emplace_back(_Args&&... __args); #endif /** Index: include/bits/stl_deque.h =================================================================== --- include/bits/stl_deque.h (revision 136738) +++ include/bits/stl_deque.h (working copy) @@ -1117,7 +1117,6 @@ * data to it. Due to the nature of a %deque this operation * can be done in constant time. */ -#ifndef __GXX_EXPERIMENTAL_CXX0X__ void push_front(const value_type& __x) { @@ -1129,20 +1128,15 @@ else _M_push_front_aux(__x); } -#else + +#ifdef __GXX_EXPERIMENTAL_CXX0X__ + void + push_front(value_type&& __x) + { emplace_front(std::move(__x)); } + template void - push_front(_Args&&... __args) - { - if (this->_M_impl._M_start._M_cur != this->_M_impl._M_start._M_first) - { - this->_M_impl.construct(this->_M_impl._M_start._M_cur - 1, - std::forward<_Args>(__args)...); - --this->_M_impl._M_start._M_cur; - } - else - _M_push_front_aux(std::forward<_Args>(__args)...); - } + emplace_front(_Args&&... __args); #endif /** @@ -1154,7 +1148,6 @@ * to it. Due to the nature of a %deque this operation can be * done in constant time. */ -#ifndef __GXX_EXPERIMENTAL_CXX0X__ void push_back(const value_type& __x) { @@ -1167,21 +1160,15 @@ else _M_push_back_aux(__x); } -#else + +#ifdef __GXX_EXPERIMENTAL_CXX0X__ + void + push_back(value_type&& __x) + { emplace_back(std::move(__x)); } + template void - push_back(_Args&&... __args) - { - if (this->_M_impl._M_finish._M_cur - != this->_M_impl._M_finish._M_last - 1) - { - this->_M_impl.construct(this->_M_impl._M_finish._M_cur, - std::forward<_Args>(__args)...); - ++this->_M_impl._M_finish._M_cur; - } - else - _M_push_back_aux(std::forward<_Args>(__args)...); - } + emplace_back(_Args&&... __args); #endif /** Index: include/bits/vector.tcc =================================================================== --- include/bits/vector.tcc (revision 136738) +++ include/bits/vector.tcc (working copy) @@ -88,7 +88,25 @@ } } +#ifdef __GXX_EXPERIMENTAL_CXX0X__ template + template + void + vector<_Tp, _Alloc>:: + emplace_back(_Args&&... __args) + { + if (this->_M_impl._M_finish != this->_M_impl._M_end_of_storage) + { + this->_M_impl.construct(this->_M_impl._M_finish, + std::forward<_Args>(__args)...); + ++this->_M_impl._M_finish; + } + else + _M_insert_aux(end(), std::forward<_Args>(__args)...); + } +#endif + + template typename vector<_Tp, _Alloc>::iterator vector<_Tp, _Alloc>:: insert(iterator __position, const value_type& __x) Index: include/bits/deque.tcc =================================================================== --- include/bits/deque.tcc (revision 136738) +++ include/bits/deque.tcc (working copy) @@ -1,6 +1,6 @@ // Deque implementation (out of line) -*- C++ -*- -// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007 +// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 // Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free @@ -85,6 +85,41 @@ return *this; } +#ifdef __GXX_EXPERIMENTAL_CXX0X__ + template + template + void + deque<_Tp, _Alloc>:: + emplace_front(_Args&&... __args) + { + if (this->_M_impl._M_start._M_cur != this->_M_impl._M_start._M_first) + { + this->_M_impl.construct(this->_M_impl._M_start._M_cur - 1, + std::forward<_Args>(__args)...); + --this->_M_impl._M_start._M_cur; + } + else + _M_push_front_aux(std::forward<_Args>(__args)...); + } + + template + template + void + deque<_Tp, _Alloc>:: + emplace_back(_Args&&... __args) + { + if (this->_M_impl._M_finish._M_cur + != this->_M_impl._M_finish._M_last - 1) + { + this->_M_impl.construct(this->_M_impl._M_finish._M_cur, + std::forward<_Args>(__args)...); + ++this->_M_impl._M_finish._M_cur; + } + else + _M_push_back_aux(std::forward<_Args>(__args)...); + } +#endif + template typename deque<_Tp, _Alloc>::iterator deque<_Tp, _Alloc>:: Index: testsuite/23_containers/vector/requirements/dr438/assign_neg.cc =================================================================== --- testsuite/23_containers/vector/requirements/dr438/assign_neg.cc (revision 136738) +++ testsuite/23_containers/vector/requirements/dr438/assign_neg.cc (working copy) @@ -19,7 +19,7 @@ // USA. // { dg-do compile } -// { dg-error "no matching" "" { target *-*-* } 992 } +// { dg-error "no matching" "" { target *-*-* } 986 } // { dg-excess-errors "" } #include Index: testsuite/23_containers/vector/requirements/dr438/insert_neg.cc =================================================================== --- testsuite/23_containers/vector/requirements/dr438/insert_neg.cc (revision 136738) +++ testsuite/23_containers/vector/requirements/dr438/insert_neg.cc (working copy) @@ -1,6 +1,6 @@ // 2007-04-27 Paolo Carlini -// Copyright (C) 2007 Free Software Foundation +// Copyright (C) 2007, 2008 Free Software Foundation // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the @@ -19,7 +19,7 @@ // USA. // { dg-do compile } -// { dg-error "no matching" "" { target *-*-* } 1033 } +// { dg-error "no matching" "" { target *-*-* } 1027 } // { dg-excess-errors "" } #include Index: testsuite/23_containers/vector/requirements/dr438/constructor_1_neg.cc =================================================================== --- testsuite/23_containers/vector/requirements/dr438/constructor_1_neg.cc (revision 136738) +++ testsuite/23_containers/vector/requirements/dr438/constructor_1_neg.cc (working copy) @@ -19,7 +19,7 @@ // USA. // { dg-do compile } -// { dg-error "no matching" "" { target *-*-* } 932 } +// { dg-error "no matching" "" { target *-*-* } 926 } // { dg-excess-errors "" } #include Index: testsuite/23_containers/vector/requirements/dr438/constructor_2_neg.cc =================================================================== --- testsuite/23_containers/vector/requirements/dr438/constructor_2_neg.cc (revision 136738) +++ testsuite/23_containers/vector/requirements/dr438/constructor_2_neg.cc (working copy) @@ -19,7 +19,7 @@ // USA. // { dg-do compile } -// { dg-error "no matching" "" { target *-*-* } 932 } +// { dg-error "no matching" "" { target *-*-* } 926 } // { dg-excess-errors "" } #include Index: testsuite/23_containers/deque/requirements/dr438/assign_neg.cc =================================================================== --- testsuite/23_containers/deque/requirements/dr438/assign_neg.cc (revision 136738) +++ testsuite/23_containers/deque/requirements/dr438/assign_neg.cc (working copy) @@ -1,6 +1,6 @@ // 2007-04-27 Paolo Carlini -// Copyright (C) 2007 Free Software Foundation +// Copyright (C) 2007, 2008 Free Software Foundation // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the @@ -19,7 +19,7 @@ // USA. // { dg-do compile } -// { dg-error "no matching" "" { target *-*-* } 1449 } +// { dg-error "no matching" "" { target *-*-* } 1436 } // { dg-excess-errors "" } #include Index: testsuite/23_containers/deque/requirements/dr438/insert_neg.cc =================================================================== --- testsuite/23_containers/deque/requirements/dr438/insert_neg.cc (revision 136738) +++ testsuite/23_containers/deque/requirements/dr438/insert_neg.cc (working copy) @@ -19,7 +19,7 @@ // USA. // { dg-do compile } -// { dg-error "no matching" "" { target *-*-* } 1533 } +// { dg-error "no matching" "" { target *-*-* } 1520 } // { dg-excess-errors "" } #include Index: testsuite/23_containers/deque/requirements/dr438/constructor_1_neg.cc =================================================================== --- testsuite/23_containers/deque/requirements/dr438/constructor_1_neg.cc (revision 136738) +++ testsuite/23_containers/deque/requirements/dr438/constructor_1_neg.cc (working copy) @@ -19,7 +19,7 @@ // USA. // { dg-do compile } -// { dg-error "no matching" "" { target *-*-* } 1388 } +// { dg-error "no matching" "" { target *-*-* } 1375 } // { dg-excess-errors "" } #include Index: testsuite/23_containers/deque/requirements/dr438/constructor_2_neg.cc =================================================================== --- testsuite/23_containers/deque/requirements/dr438/constructor_2_neg.cc (revision 136738) +++ testsuite/23_containers/deque/requirements/dr438/constructor_2_neg.cc (working copy) @@ -19,7 +19,7 @@ // USA. // { dg-do compile } -// { dg-error "no matching" "" { target *-*-* } 1388 } +// { dg-error "no matching" "" { target *-*-* } 1375 } // { dg-excess-errors "" } #include Index: testsuite/23_containers/list/requirements/dr438/assign_neg.cc =================================================================== --- testsuite/23_containers/list/requirements/dr438/assign_neg.cc (revision 136738) +++ testsuite/23_containers/list/requirements/dr438/assign_neg.cc (working copy) @@ -19,7 +19,7 @@ // USA. // { dg-do compile } -// { dg-error "no matching" "" { target *-*-* } 1317 } +// { dg-error "no matching" "" { target *-*-* } 1325 } // { dg-excess-errors "" } #include Index: testsuite/23_containers/list/requirements/dr438/insert_neg.cc =================================================================== --- testsuite/23_containers/list/requirements/dr438/insert_neg.cc (revision 136738) +++ testsuite/23_containers/list/requirements/dr438/insert_neg.cc (working copy) @@ -19,7 +19,7 @@ // USA. // { dg-do compile } -// { dg-error "no matching" "" { target *-*-* } 1286 } +// { dg-error "no matching" "" { target *-*-* } 1294 } // { dg-excess-errors "" } #include Index: testsuite/23_containers/list/requirements/dr438/constructor_1_neg.cc =================================================================== --- testsuite/23_containers/list/requirements/dr438/constructor_1_neg.cc (revision 136738) +++ testsuite/23_containers/list/requirements/dr438/constructor_1_neg.cc (working copy) @@ -19,7 +19,7 @@ // USA. // { dg-do compile } -// { dg-error "no matching" "" { target *-*-* } 1286 } +// { dg-error "no matching" "" { target *-*-* } 1294 } // { dg-excess-errors "" } #include Index: testsuite/23_containers/list/requirements/dr438/constructor_2_neg.cc =================================================================== --- testsuite/23_containers/list/requirements/dr438/constructor_2_neg.cc (revision 136738) +++ testsuite/23_containers/list/requirements/dr438/constructor_2_neg.cc (working copy) @@ -19,7 +19,7 @@ // USA. // { dg-do compile } -// { dg-error "no matching" "" { target *-*-* } 1286 } +// { dg-error "no matching" "" { target *-*-* } 1294 } // { dg-excess-errors "" } #include