diff --git a/include/ircd/buffer.h b/include/ircd/buffer.h index 505ae68d1..467dc0d5b 100644 --- a/include/ircd/buffer.h +++ b/include/ircd/buffer.h @@ -351,9 +351,9 @@ struct ircd::buffer::fixed_buffer :array_type{{0}} {} - fixed_buffer(const std::function &closure) + fixed_buffer(const std::function &closure) { - closure(mutable_raw_buffer{std::begin(*this), std::end(*this)}); + closure(mutable_buffer{reinterpret_cast(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>::value, + "ircd::buffer::fixed_buffer must be standard layout" +); + /// Like unique_ptr, this template holds ownership of an allocated buffer /// ///