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:
parent
a663e80254
commit
dd80b127b4
1 changed files with 9 additions and 2 deletions
|
@ -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
|
||||
///
|
||||
///
|
||||
|
|
Loading…
Reference in a new issue