@@ -2041,20 +2041,20 @@ void deque<_Tp, _Allocator>::__add_front_capacity() {
20412041 __start_ += __block_size;
20422042 pointer __pt = __map_.back ();
20432043 __map_.pop_back ();
2044- __map_.push_front (__pt);
2044+ __map_.emplace_front (__pt);
20452045 }
20462046 // Else if __map_.size() < __map_.capacity() then we need to allocate 1 buffer
20472047 else if (__map_.size () < __map_.capacity ()) { // we can put the new buffer into the map, but don't shift things around
20482048 // until all buffers are allocated. If we throw, we don't need to fix
20492049 // anything up (any added buffers are undetectible)
20502050 if (__map_.__front_spare () > 0 )
2051- __map_.push_front (__alloc_traits::allocate (__a, __block_size));
2051+ __map_.emplace_front (__alloc_traits::allocate (__a, __block_size));
20522052 else {
2053- __map_.push_back (__alloc_traits::allocate (__a, __block_size));
2053+ __map_.emplace_back (__alloc_traits::allocate (__a, __block_size));
20542054 // Done allocating, reorder capacity
20552055 pointer __pt = __map_.back ();
20562056 __map_.pop_back ();
2057- __map_.push_front (__pt);
2057+ __map_.emplace_front (__pt);
20582058 }
20592059 __start_ = __map_.size () == 1 ? __block_size / 2 : __start_ + __block_size;
20602060 }
@@ -2065,11 +2065,11 @@ void deque<_Tp, _Allocator>::__add_front_capacity() {
20652065
20662066 typedef __allocator_destructor<_Allocator> _Dp;
20672067 unique_ptr<pointer, _Dp> __hold (__alloc_traits::allocate (__a, __block_size), _Dp (__a, __block_size));
2068- __buf.push_back (__hold.get ());
2068+ __buf.emplace_back (__hold.get ());
20692069 __hold.release ();
20702070
20712071 for (__map_pointer __i = __map_.begin (); __i != __map_.end (); ++__i)
2072- __buf.push_back (*__i);
2072+ __buf.emplace_back (*__i);
20732073 std::swap (__map_.__first_ , __buf.__first_ );
20742074 std::swap (__map_.__begin_ , __buf.__begin_ );
20752075 std::swap (__map_.__end_ , __buf.__end_ );
@@ -2095,7 +2095,7 @@ void deque<_Tp, _Allocator>::__add_front_capacity(size_type __n) {
20952095 for (; __back_capacity > 0 ; --__back_capacity) {
20962096 pointer __pt = __map_.back ();
20972097 __map_.pop_back ();
2098- __map_.push_front (__pt);
2098+ __map_.emplace_front (__pt);
20992099 }
21002100 }
21012101 // Else if __nb <= __map_.capacity() - __map_.size() then we need to allocate __nb buffers
@@ -2106,17 +2106,17 @@ void deque<_Tp, _Allocator>::__add_front_capacity(size_type __n) {
21062106 for (; __nb > 0 ; --__nb, __start_ += __block_size - (__map_.size () == 1 )) {
21072107 if (__map_.__front_spare () == 0 )
21082108 break ;
2109- __map_.push_front (__alloc_traits::allocate (__a, __block_size));
2109+ __map_.emplace_front (__alloc_traits::allocate (__a, __block_size));
21102110 __annotate_whole_block (0 , __asan_poison);
21112111 }
21122112 for (; __nb > 0 ; --__nb, ++__back_capacity)
2113- __map_.push_back (__alloc_traits::allocate (__a, __block_size));
2113+ __map_.emplace_back (__alloc_traits::allocate (__a, __block_size));
21142114 // Done allocating, reorder capacity
21152115 __start_ += __back_capacity * __block_size;
21162116 for (; __back_capacity > 0 ; --__back_capacity) {
21172117 pointer __pt = __map_.back ();
21182118 __map_.pop_back ();
2119- __map_.push_front (__pt);
2119+ __map_.emplace_front (__pt);
21202120 __annotate_whole_block (0 , __asan_poison);
21212121 }
21222122 }
@@ -2129,7 +2129,7 @@ void deque<_Tp, _Allocator>::__add_front_capacity(size_type __n) {
21292129 try {
21302130#endif // _LIBCPP_HAS_EXCEPTIONS
21312131 for (; __nb > 0 ; --__nb) {
2132- __buf.push_back (__alloc_traits::allocate (__a, __block_size));
2132+ __buf.emplace_back (__alloc_traits::allocate (__a, __block_size));
21332133 // ASan: this is empty container, we have to poison whole block
21342134 __annotate_poison_block (std::__to_address (__buf.back ()), std::__to_address (__buf.back () + __block_size));
21352135 }
@@ -2142,11 +2142,11 @@ void deque<_Tp, _Allocator>::__add_front_capacity(size_type __n) {
21422142 }
21432143#endif // _LIBCPP_HAS_EXCEPTIONS
21442144 for (; __back_capacity > 0 ; --__back_capacity) {
2145- __buf.push_back (__map_.back ());
2145+ __buf.emplace_back (__map_.back ());
21462146 __map_.pop_back ();
21472147 }
21482148 for (__map_pointer __i = __map_.begin (); __i != __map_.end (); ++__i)
2149- __buf.push_back (*__i);
2149+ __buf.emplace_back (*__i);
21502150 std::swap (__map_.__first_ , __buf.__first_ );
21512151 std::swap (__map_.__begin_ , __buf.__begin_ );
21522152 std::swap (__map_.__end_ , __buf.__end_ );
@@ -2164,20 +2164,20 @@ void deque<_Tp, _Allocator>::__add_back_capacity() {
21642164 __start_ -= __block_size;
21652165 pointer __pt = __map_.front ();
21662166 __map_.pop_front ();
2167- __map_.push_back (__pt);
2167+ __map_.emplace_back (__pt);
21682168 }
21692169 // Else if __nb <= __map_.capacity() - __map_.size() then we need to allocate __nb buffers
21702170 else if (__map_.size () < __map_.capacity ()) { // we can put the new buffer into the map, but don't shift things around
21712171 // until it is allocated. If we throw, we don't need to fix
21722172 // anything up (any added buffers are undetectible)
21732173 if (__map_.__back_spare () != 0 )
2174- __map_.push_back (__alloc_traits::allocate (__a, __block_size));
2174+ __map_.emplace_back (__alloc_traits::allocate (__a, __block_size));
21752175 else {
2176- __map_.push_front (__alloc_traits::allocate (__a, __block_size));
2176+ __map_.emplace_front (__alloc_traits::allocate (__a, __block_size));
21772177 // Done allocating, reorder capacity
21782178 pointer __pt = __map_.front ();
21792179 __map_.pop_front ();
2180- __map_.push_back (__pt);
2180+ __map_.emplace_back (__pt);
21812181 }
21822182 __annotate_whole_block (__map_.size () - 1 , __asan_poison);
21832183 }
@@ -2188,11 +2188,11 @@ void deque<_Tp, _Allocator>::__add_back_capacity() {
21882188
21892189 typedef __allocator_destructor<_Allocator> _Dp;
21902190 unique_ptr<pointer, _Dp> __hold (__alloc_traits::allocate (__a, __block_size), _Dp (__a, __block_size));
2191- __buf.push_back (__hold.get ());
2191+ __buf.emplace_back (__hold.get ());
21922192 __hold.release ();
21932193
21942194 for (__map_pointer __i = __map_.end (); __i != __map_.begin ();)
2195- __buf.push_front (*--__i);
2195+ __buf.emplace_front (*--__i);
21962196 std::swap (__map_.__first_ , __buf.__first_ );
21972197 std::swap (__map_.__begin_ , __buf.__begin_ );
21982198 std::swap (__map_.__end_ , __buf.__end_ );
@@ -2217,7 +2217,7 @@ void deque<_Tp, _Allocator>::__add_back_capacity(size_type __n) {
22172217 for (; __front_capacity > 0 ; --__front_capacity) {
22182218 pointer __pt = __map_.front ();
22192219 __map_.pop_front ();
2220- __map_.push_back (__pt);
2220+ __map_.emplace_back (__pt);
22212221 }
22222222 }
22232223 // Else if __nb <= __map_.capacity() - __map_.size() then we need to allocate __nb buffers
@@ -2228,19 +2228,19 @@ void deque<_Tp, _Allocator>::__add_back_capacity(size_type __n) {
22282228 for (; __nb > 0 ; --__nb) {
22292229 if (__map_.__back_spare () == 0 )
22302230 break ;
2231- __map_.push_back (__alloc_traits::allocate (__a, __block_size));
2231+ __map_.emplace_back (__alloc_traits::allocate (__a, __block_size));
22322232 __annotate_whole_block (__map_.size () - 1 , __asan_poison);
22332233 }
22342234 for (; __nb > 0 ; --__nb, ++__front_capacity, __start_ += __block_size - (__map_.size () == 1 )) {
2235- __map_.push_front (__alloc_traits::allocate (__a, __block_size));
2235+ __map_.emplace_front (__alloc_traits::allocate (__a, __block_size));
22362236 __annotate_whole_block (0 , __asan_poison);
22372237 }
22382238 // Done allocating, reorder capacity
22392239 __start_ -= __block_size * __front_capacity;
22402240 for (; __front_capacity > 0 ; --__front_capacity) {
22412241 pointer __pt = __map_.front ();
22422242 __map_.pop_front ();
2243- __map_.push_back (__pt);
2243+ __map_.emplace_back (__pt);
22442244 }
22452245 }
22462246 // Else need to allocate __nb buffers, *and* we need to reallocate __map_.
@@ -2254,7 +2254,7 @@ void deque<_Tp, _Allocator>::__add_back_capacity(size_type __n) {
22542254 try {
22552255#endif // _LIBCPP_HAS_EXCEPTIONS
22562256 for (; __nb > 0 ; --__nb) {
2257- __buf.push_back (__alloc_traits::allocate (__a, __block_size));
2257+ __buf.emplace_back (__alloc_traits::allocate (__a, __block_size));
22582258 // ASan: this is an empty container, we have to poison the whole block
22592259 __annotate_poison_block (std::__to_address (__buf.back ()), std::__to_address (__buf.back () + __block_size));
22602260 }
@@ -2267,11 +2267,11 @@ void deque<_Tp, _Allocator>::__add_back_capacity(size_type __n) {
22672267 }
22682268#endif // _LIBCPP_HAS_EXCEPTIONS
22692269 for (; __front_capacity > 0 ; --__front_capacity) {
2270- __buf.push_back (__map_.front ());
2270+ __buf.emplace_back (__map_.front ());
22712271 __map_.pop_front ();
22722272 }
22732273 for (__map_pointer __i = __map_.end (); __i != __map_.begin ();)
2274- __buf.push_front (*--__i);
2274+ __buf.emplace_front (*--__i);
22752275 std::swap (__map_.__first_ , __buf.__first_ );
22762276 std::swap (__map_.__begin_ , __buf.__begin_ );
22772277 std::swap (__map_.__end_ , __buf.__end_ );
0 commit comments