Boost C++ Libraries: Ticket #13639: monotonic_buffer_resource current_buffer() possibly broken and documentation wrong https://svn.boost.org/trac10/ticket/13639 <p> The comment and the function declaration do not seem to match: </p> <pre class="wiki"> //! &lt;b&gt;Returns&lt;/b&gt;: //! The number of bytes of storage available for the specified alignment. //! //! &lt;b&gt;Note&lt;/b&gt;: Non-standard extension. const void *current_buffer() const BOOST_NOEXCEPT; </pre><p> Source: <a class="ext-link" href="https://www.boost.org/doc/libs/1_67_0/boost/container/pmr/monotonic_buffer_resource.hpp"><span class="icon">​</span>https://www.boost.org/doc/libs/1_67_0/boost/container/pmr/monotonic_buffer_resource.hpp</a> </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/13639 Trac 1.4.3 Markus Dreseler Sat, 21 Jul 2018 15:19:17 GMT severity, summary changed https://svn.boost.org/trac10/ticket/13639#comment:1 https://svn.boost.org/trac10/ticket/13639#comment:1 <ul> <li><strong>severity</strong> <span class="trac-field-old">Cosmetic</span> → <span class="trac-field-new">Problem</span> </li> <li><strong>summary</strong> <span class="trac-field-old">Documentation of monotonic_buffer_resource looks wrong</span> → <span class="trac-field-new">monotonic_buffer_resource current_buffer() possibly broken and documentation wrong</span> </li> </ul> <p> Looking at this again, it looks like current_buffer itself is also broken. Instead of returning a pointer to the start of the current buffer, it returns a pointer to where the next allocation should go: </p> <pre class="wiki">// clang++ -std=c++1z -lboost_container mbr.cpp #include &lt;boost/container/pmr/monotonic_buffer_resource.hpp&gt; #include &lt;boost/container/pmr/polymorphic_allocator.hpp&gt; #include &lt;iostream&gt; int main() { auto buffer = boost::container::pmr::monotonic_buffer_resource(size_t{100}); auto allocator = boost::container::pmr::polymorphic_allocator&lt;char&gt;{&amp;buffer}; allocator.allocate(1); auto start_ptr = buffer.current_buffer(); allocator.allocate(50); auto end_ptr = buffer.current_buffer(); std::cout &lt;&lt; (reinterpret_cast&lt;uintptr_t&gt;(end_ptr) - reinterpret_cast&lt;uintptr_t&gt;(start_ptr)) &lt;&lt; std::endl; // prints 50, but should be 0 } </pre><p> Using clang 6.0 on OSX with boost 1.67.0_1. </p> Ticket