-
Notifications
You must be signed in to change notification settings - Fork 63
Add emplace_{back,front} to circular_buffer - rebased to latest develop #42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Changes from 1 commit
df790ee
c7c0d4a
90ef625
19a1ce4
e5b44b1
d5819ae
c4c85d7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1460,7 +1460,8 @@ private empty_value<Alloc> | |
| if (full()) { | ||
| if (empty()) | ||
| return; | ||
| replace(m_last, value_type(::boost::forward<Args>(args)...)); | ||
| destroy_item(m_last); | ||
| boost::allocator_construct(alloc(), boost::to_address(m_last), ::boost::forward<Args>(args)...); | ||
| increment(m_last); | ||
| m_first = m_last; | ||
| } else { | ||
|
|
@@ -1475,7 +1476,8 @@ private empty_value<Alloc> | |
| if (full()) { | ||
| if (empty()) | ||
| return; | ||
| replace(m_last, value_type(::boost::forward<V>(value))); | ||
| destroy_item(m_last); | ||
| boost::allocator_construct(alloc(), boost::to_address(m_last), ::boost::forward<Args>(args)...); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This has not been compiled with BOOST_NO_CXX11_VARIADIC_TEMPLATES defined because I do not think this would compile. There is no variadic template parameter Args (args) here |
||
| increment(m_last); | ||
| m_first = m_last; | ||
| } else { | ||
|
|
@@ -1494,7 +1496,8 @@ private empty_value<Alloc> | |
| if (empty()) | ||
| return; | ||
| decrement(m_first); | ||
| replace(m_first, value_type(::boost::forward<Args>(args)...)); | ||
| destroy_item(m_first); | ||
| boost::allocator_construct(alloc(), boost::to_address(m_first), ::boost::forward<Args>(args)...); | ||
| m_last = m_first; | ||
| } else { | ||
| decrement(m_first); | ||
|
|
@@ -1515,7 +1518,8 @@ private empty_value<Alloc> | |
| if (empty()) | ||
| return; | ||
| decrement(m_first); | ||
| replace(m_first, value_type(::boost::forward<V>(value))); | ||
| destroy_item(m_first); | ||
| boost::allocator_construct(alloc(), boost::to_address(m_first), ::boost::forward<Args>(args)...); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This has not been compiled with BOOST_NO_CXX11_VARIADIC_TEMPLATES defined because I do not think this would compile. There is no variadic template parameter Args (args) here |
||
| m_last = m_first; | ||
| } else { | ||
| decrement(m_first); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this line is wrong. This is your bug!
This is where the temporary object gets created.
What do you think value_type(...) is doing?
It creates a temporary object and call the replace() method that is using assignment!