@@ -2041,20 +2041,20 @@ void deque<_Tp, _Allocator>::__add_front_capacity() {
2041
2041
__start_ += __block_size;
2042
2042
pointer __pt = __map_.back ();
2043
2043
__map_.pop_back ();
2044
- __map_.push_front (__pt);
2044
+ __map_.emplace_front (__pt);
2045
2045
}
2046
2046
// Else if __map_.size() < __map_.capacity() then we need to allocate 1 buffer
2047
2047
else if (__map_.size () < __map_.capacity ()) { // we can put the new buffer into the map, but don't shift things around
2048
2048
// until all buffers are allocated. If we throw, we don't need to fix
2049
2049
// anything up (any added buffers are undetectible)
2050
2050
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));
2052
2052
else {
2053
- __map_.push_back (__alloc_traits::allocate (__a, __block_size));
2053
+ __map_.emplace_back (__alloc_traits::allocate (__a, __block_size));
2054
2054
// Done allocating, reorder capacity
2055
2055
pointer __pt = __map_.back ();
2056
2056
__map_.pop_back ();
2057
- __map_.push_front (__pt);
2057
+ __map_.emplace_front (__pt);
2058
2058
}
2059
2059
__start_ = __map_.size () == 1 ? __block_size / 2 : __start_ + __block_size;
2060
2060
}
@@ -2065,11 +2065,11 @@ void deque<_Tp, _Allocator>::__add_front_capacity() {
2065
2065
2066
2066
typedef __allocator_destructor<_Allocator> _Dp;
2067
2067
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 ());
2069
2069
__hold.release ();
2070
2070
2071
2071
for (__map_pointer __i = __map_.begin (); __i != __map_.end (); ++__i)
2072
- __buf.push_back (*__i);
2072
+ __buf.emplace_back (*__i);
2073
2073
std::swap (__map_.__first_ , __buf.__first_ );
2074
2074
std::swap (__map_.__begin_ , __buf.__begin_ );
2075
2075
std::swap (__map_.__end_ , __buf.__end_ );
@@ -2095,7 +2095,7 @@ void deque<_Tp, _Allocator>::__add_front_capacity(size_type __n) {
2095
2095
for (; __back_capacity > 0 ; --__back_capacity) {
2096
2096
pointer __pt = __map_.back ();
2097
2097
__map_.pop_back ();
2098
- __map_.push_front (__pt);
2098
+ __map_.emplace_front (__pt);
2099
2099
}
2100
2100
}
2101
2101
// 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) {
2106
2106
for (; __nb > 0 ; --__nb, __start_ += __block_size - (__map_.size () == 1 )) {
2107
2107
if (__map_.__front_spare () == 0 )
2108
2108
break ;
2109
- __map_.push_front (__alloc_traits::allocate (__a, __block_size));
2109
+ __map_.emplace_front (__alloc_traits::allocate (__a, __block_size));
2110
2110
__annotate_whole_block (0 , __asan_poison);
2111
2111
}
2112
2112
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));
2114
2114
// Done allocating, reorder capacity
2115
2115
__start_ += __back_capacity * __block_size;
2116
2116
for (; __back_capacity > 0 ; --__back_capacity) {
2117
2117
pointer __pt = __map_.back ();
2118
2118
__map_.pop_back ();
2119
- __map_.push_front (__pt);
2119
+ __map_.emplace_front (__pt);
2120
2120
__annotate_whole_block (0 , __asan_poison);
2121
2121
}
2122
2122
}
@@ -2129,7 +2129,7 @@ void deque<_Tp, _Allocator>::__add_front_capacity(size_type __n) {
2129
2129
try {
2130
2130
#endif // _LIBCPP_HAS_EXCEPTIONS
2131
2131
for (; __nb > 0 ; --__nb) {
2132
- __buf.push_back (__alloc_traits::allocate (__a, __block_size));
2132
+ __buf.emplace_back (__alloc_traits::allocate (__a, __block_size));
2133
2133
// ASan: this is empty container, we have to poison whole block
2134
2134
__annotate_poison_block (std::__to_address (__buf.back ()), std::__to_address (__buf.back () + __block_size));
2135
2135
}
@@ -2142,11 +2142,11 @@ void deque<_Tp, _Allocator>::__add_front_capacity(size_type __n) {
2142
2142
}
2143
2143
#endif // _LIBCPP_HAS_EXCEPTIONS
2144
2144
for (; __back_capacity > 0 ; --__back_capacity) {
2145
- __buf.push_back (__map_.back ());
2145
+ __buf.emplace_back (__map_.back ());
2146
2146
__map_.pop_back ();
2147
2147
}
2148
2148
for (__map_pointer __i = __map_.begin (); __i != __map_.end (); ++__i)
2149
- __buf.push_back (*__i);
2149
+ __buf.emplace_back (*__i);
2150
2150
std::swap (__map_.__first_ , __buf.__first_ );
2151
2151
std::swap (__map_.__begin_ , __buf.__begin_ );
2152
2152
std::swap (__map_.__end_ , __buf.__end_ );
@@ -2164,20 +2164,20 @@ void deque<_Tp, _Allocator>::__add_back_capacity() {
2164
2164
__start_ -= __block_size;
2165
2165
pointer __pt = __map_.front ();
2166
2166
__map_.pop_front ();
2167
- __map_.push_back (__pt);
2167
+ __map_.emplace_back (__pt);
2168
2168
}
2169
2169
// Else if __nb <= __map_.capacity() - __map_.size() then we need to allocate __nb buffers
2170
2170
else if (__map_.size () < __map_.capacity ()) { // we can put the new buffer into the map, but don't shift things around
2171
2171
// until it is allocated. If we throw, we don't need to fix
2172
2172
// anything up (any added buffers are undetectible)
2173
2173
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));
2175
2175
else {
2176
- __map_.push_front (__alloc_traits::allocate (__a, __block_size));
2176
+ __map_.emplace_front (__alloc_traits::allocate (__a, __block_size));
2177
2177
// Done allocating, reorder capacity
2178
2178
pointer __pt = __map_.front ();
2179
2179
__map_.pop_front ();
2180
- __map_.push_back (__pt);
2180
+ __map_.emplace_back (__pt);
2181
2181
}
2182
2182
__annotate_whole_block (__map_.size () - 1 , __asan_poison);
2183
2183
}
@@ -2188,11 +2188,11 @@ void deque<_Tp, _Allocator>::__add_back_capacity() {
2188
2188
2189
2189
typedef __allocator_destructor<_Allocator> _Dp;
2190
2190
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 ());
2192
2192
__hold.release ();
2193
2193
2194
2194
for (__map_pointer __i = __map_.end (); __i != __map_.begin ();)
2195
- __buf.push_front (*--__i);
2195
+ __buf.emplace_front (*--__i);
2196
2196
std::swap (__map_.__first_ , __buf.__first_ );
2197
2197
std::swap (__map_.__begin_ , __buf.__begin_ );
2198
2198
std::swap (__map_.__end_ , __buf.__end_ );
@@ -2217,7 +2217,7 @@ void deque<_Tp, _Allocator>::__add_back_capacity(size_type __n) {
2217
2217
for (; __front_capacity > 0 ; --__front_capacity) {
2218
2218
pointer __pt = __map_.front ();
2219
2219
__map_.pop_front ();
2220
- __map_.push_back (__pt);
2220
+ __map_.emplace_back (__pt);
2221
2221
}
2222
2222
}
2223
2223
// 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) {
2228
2228
for (; __nb > 0 ; --__nb) {
2229
2229
if (__map_.__back_spare () == 0 )
2230
2230
break ;
2231
- __map_.push_back (__alloc_traits::allocate (__a, __block_size));
2231
+ __map_.emplace_back (__alloc_traits::allocate (__a, __block_size));
2232
2232
__annotate_whole_block (__map_.size () - 1 , __asan_poison);
2233
2233
}
2234
2234
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));
2236
2236
__annotate_whole_block (0 , __asan_poison);
2237
2237
}
2238
2238
// Done allocating, reorder capacity
2239
2239
__start_ -= __block_size * __front_capacity;
2240
2240
for (; __front_capacity > 0 ; --__front_capacity) {
2241
2241
pointer __pt = __map_.front ();
2242
2242
__map_.pop_front ();
2243
- __map_.push_back (__pt);
2243
+ __map_.emplace_back (__pt);
2244
2244
}
2245
2245
}
2246
2246
// 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) {
2254
2254
try {
2255
2255
#endif // _LIBCPP_HAS_EXCEPTIONS
2256
2256
for (; __nb > 0 ; --__nb) {
2257
- __buf.push_back (__alloc_traits::allocate (__a, __block_size));
2257
+ __buf.emplace_back (__alloc_traits::allocate (__a, __block_size));
2258
2258
// ASan: this is an empty container, we have to poison the whole block
2259
2259
__annotate_poison_block (std::__to_address (__buf.back ()), std::__to_address (__buf.back () + __block_size));
2260
2260
}
@@ -2267,11 +2267,11 @@ void deque<_Tp, _Allocator>::__add_back_capacity(size_type __n) {
2267
2267
}
2268
2268
#endif // _LIBCPP_HAS_EXCEPTIONS
2269
2269
for (; __front_capacity > 0 ; --__front_capacity) {
2270
- __buf.push_back (__map_.front ());
2270
+ __buf.emplace_back (__map_.front ());
2271
2271
__map_.pop_front ();
2272
2272
}
2273
2273
for (__map_pointer __i = __map_.end (); __i != __map_.begin ();)
2274
- __buf.push_front (*--__i);
2274
+ __buf.emplace_front (*--__i);
2275
2275
std::swap (__map_.__first_ , __buf.__first_ );
2276
2276
std::swap (__map_.__begin_ , __buf.__begin_ );
2277
2277
std::swap (__map_.__end_ , __buf.__end_ );
0 commit comments