0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-12-28 16:34:13 +01:00

ircd::buffer: Fix the closure type so it's not too strict.

This commit is contained in:
Jason Volk 2017-10-11 17:51:43 -07:00
parent a663e80254
commit dd80b127b4

View file

@ -351,9 +351,9 @@ struct ircd::buffer::fixed_buffer
:array_type{{0}}
{}
fixed_buffer(const std::function<void (const mutable_raw_buffer &)> &closure)
fixed_buffer(const std::function<void (const mutable_buffer &)> &closure)
{
closure(mutable_raw_buffer{std::begin(*this), std::end(*this)});
closure(mutable_buffer{reinterpret_cast<mutable_buffer::iterator>(this->data()), this->size()});
}
fixed_buffer(buffer b)
@ -363,6 +363,13 @@ struct ircd::buffer::fixed_buffer
fixed_buffer() = default;
};
static_assert
(
// Assertion over an arbitrary but common template configuration.
std::is_standard_layout<ircd::buffer::fixed_buffer<ircd::buffer::const_buffer, 32>>::value,
"ircd::buffer::fixed_buffer must be standard layout"
);
/// Like unique_ptr, this template holds ownership of an allocated buffer
///
///