static_buffer coverage

This commit is contained in:
Vinnie Falco committed 2017-06-10 16:00:42 -07:00
1 parent 18a8ef5a3b
commit 7351d6eae4
7 files changed
+210 -32

No files matched your search

+26 -1
View File
@@ -76,7 +76,7 @@ prepare_impl(std::size_t n) ->
auto const len = size();
if(n > capacity() - len)
BOOST_THROW_EXCEPTION(std::length_error{
"static_buffer overflow"});
"buffer overflow"});
if(len > 0)
std::memmove(begin_, in_, len);
in_ = begin_;
@@ -99,6 +99,31 @@ consume_impl(std::size_t n)
in_ += n;
}
//------------------------------------------------------------------------------
template<std::size_t N>
static_buffer_n<N>::
static_buffer_n(static_buffer_n const& other)
: static_buffer(buf_, N)
{
using boost::asio::buffer_copy;
this->commit(buffer_copy(
this->prepare(other.size()), other.data()));
}
template<std::size_t N>
auto
static_buffer_n<N>::
operator=(static_buffer_n const& other) ->
static_buffer_n<N>&
{
using boost::asio::buffer_copy;
this->consume(this->size());
this->commit(buffer_copy(
this->prepare(other.size()), other.data()));
return *this;
}
} // beast
#endif