diff --git a/include/ircd/buffer.h b/include/ircd/buffer.h index b952ef5b2..47c8d56df 100644 --- a/include/ircd/buffer.h +++ b/include/ircd/buffer.h @@ -63,6 +63,7 @@ namespace ircd::buffer template size_t consume(buffer &buffer, const size_t &bytes); template buffer operator+(const buffer &buffer, const size_t &bytes); template it copy(it &dest, const it &stop, const const_buffer &); + template size_t copy(const mutable_buffer &dst, const char (&buf)[SIZE]); size_t copy(const mutable_buffer &dst, const const_buffer &src); size_t reverse(const mutable_buffer &dst, const const_buffer &src); void reverse(const mutable_buffer &buf); @@ -535,6 +536,19 @@ ircd::buffer::reverse(const mutable_buffer &dst, return ret; } +template +__attribute__((error +( + "Copy source is an array. Is this a string literal? Do you want to copy the \\0?" + " Disambiguate this by typing the source string_view or const_buffer." +))) +inline size_t +ircd::buffer::copy(const mutable_buffer &dst, + const char (&buf)[SIZE]) +{ + return copy(dst, const_buffer{buf}); +} + inline size_t ircd::buffer::copy(const mutable_buffer &dst, const const_buffer &src)