mirror of
https://github.com/boostorg/beast.git
synced 2025-07-31 21:34:46 +02:00
@@ -1,5 +1,6 @@
|
|||||||
Version XXX:
|
Version XXX:
|
||||||
|
|
||||||
|
* flat_buffer shrink_to_fit is noexcept
|
||||||
* moved-from dynamic buffers do not clear if different allocator
|
* moved-from dynamic buffers do not clear if different allocator
|
||||||
* fix erase field
|
* fix erase field
|
||||||
|
|
||||||
|
@@ -358,17 +358,17 @@ public:
|
|||||||
void
|
void
|
||||||
reserve(std::size_t n);
|
reserve(std::size_t n);
|
||||||
|
|
||||||
/** Reallocate the buffer to fit the readable bytes exactly.
|
/** Request the removal of unused capacity.
|
||||||
|
|
||||||
Buffer sequences previously obtained using @ref data or
|
This function attempts to reduce @ref capacity()
|
||||||
@ref prepare become invalid.
|
to @ref size(), which may not succeed.
|
||||||
|
|
||||||
@esafe
|
@esafe
|
||||||
|
|
||||||
Strong guarantee.
|
No-throw guarantee.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
shrink_to_fit();
|
shrink_to_fit() noexcept;
|
||||||
|
|
||||||
/** Set the size of the readable and writable bytes to zero.
|
/** Set the size of the readable and writable bytes to zero.
|
||||||
|
|
||||||
|
@@ -260,17 +260,32 @@ reserve(std::size_t n)
|
|||||||
template<class Allocator>
|
template<class Allocator>
|
||||||
void
|
void
|
||||||
basic_flat_buffer<Allocator>::
|
basic_flat_buffer<Allocator>::
|
||||||
shrink_to_fit()
|
shrink_to_fit() noexcept
|
||||||
{
|
{
|
||||||
auto const len = size();
|
auto const len = size();
|
||||||
|
|
||||||
if(len == capacity())
|
if(len == capacity())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
char* p;
|
char* p;
|
||||||
if(len > 0)
|
if(len > 0)
|
||||||
{
|
{
|
||||||
BOOST_ASSERT(begin_);
|
BOOST_ASSERT(begin_);
|
||||||
BOOST_ASSERT(in_);
|
BOOST_ASSERT(in_);
|
||||||
p = alloc(len);
|
#ifndef BOOST_NO_EXCEPTIONS
|
||||||
|
try
|
||||||
|
{
|
||||||
|
#endif
|
||||||
|
p = alloc(len);
|
||||||
|
#ifndef BOOST_NO_EXCEPTIONS
|
||||||
|
}
|
||||||
|
catch(std::exception const&)
|
||||||
|
{
|
||||||
|
// request could not be fulfilled,
|
||||||
|
// squelch the exception
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
std::memcpy(p, in_, len);
|
std::memcpy(p, in_, len);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
Reference in New Issue
Block a user