forked from boostorg/beast
3 files changed
+23
-7
No files matched your search
@@ -260,17 +260,32 @@ reserve(std::size_t n)
|
||||
template<class Allocator>
|
||||
void
|
||||
basic_flat_buffer<Allocator>::
|
||||
shrink_to_fit()
|
||||
shrink_to_fit() noexcept
|
||||
{
|
||||
auto const len = size();
|
||||
|
||||
if(len == capacity())
|
||||
return;
|
||||
|
||||
char* p;
|
||||
if(len > 0)
|
||||
{
|
||||
BOOST_ASSERT(begin_);
|
||||
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);
|
||||
}
|
||||
else
|
||||
|
||||
Reference in new issue
Block a user