Skip to content

Commit c4c85d7

Browse files
author
f9z
committed
replace replace() with destroy_item() + construct()
1 parent d5819ae commit c4c85d7

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

include/boost/circular_buffer/base.hpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1460,7 +1460,8 @@ private empty_value<Alloc>
14601460
if (full()) {
14611461
if (empty())
14621462
return;
1463-
replace(m_last, value_type(::boost::forward<Args>(args)...));
1463+
destroy_item(m_last);
1464+
boost::allocator_construct(alloc(), boost::to_address(m_last), ::boost::forward<Args>(args)...);
14641465
increment(m_last);
14651466
m_first = m_last;
14661467
} else {
@@ -1475,7 +1476,8 @@ private empty_value<Alloc>
14751476
if (full()) {
14761477
if (empty())
14771478
return;
1478-
replace(m_last, value_type(::boost::forward<V>(value)));
1479+
destroy_item(m_last);
1480+
boost::allocator_construct(alloc(), boost::to_address(m_last), ::boost::forward<Args>(args)...);
14791481
increment(m_last);
14801482
m_first = m_last;
14811483
} else {
@@ -1494,7 +1496,8 @@ private empty_value<Alloc>
14941496
if (empty())
14951497
return;
14961498
decrement(m_first);
1497-
replace(m_first, value_type(::boost::forward<Args>(args)...));
1499+
destroy_item(m_first);
1500+
boost::allocator_construct(alloc(), boost::to_address(m_first), ::boost::forward<Args>(args)...);
14981501
m_last = m_first;
14991502
} else {
15001503
decrement(m_first);
@@ -1515,7 +1518,8 @@ private empty_value<Alloc>
15151518
if (empty())
15161519
return;
15171520
decrement(m_first);
1518-
replace(m_first, value_type(::boost::forward<V>(value)));
1521+
destroy_item(m_first);
1522+
boost::allocator_construct(alloc(), boost::to_address(m_first), ::boost::forward<Args>(args)...);
15191523
m_last = m_first;
15201524
} else {
15211525
decrement(m_first);

0 commit comments

Comments
 (0)