diff --git a/include/ircd/json.h b/include/ircd/json.h index 451848dd6..e18b25dce 100644 --- a/include/ircd/json.h +++ b/include/ircd/json.h @@ -94,6 +94,7 @@ namespace ircd::json template size_t print(char *const &buf, const size_t &max, T&&... t); template size_t print(const mutable_buffer &buf, T&&... t); template std::string string(T&&... t); + template struct buffer; size_t serialized(const string_view &); @@ -113,6 +114,18 @@ namespace ircd using json::operator<<; } +template +struct ircd::json::buffer +:string_view +{ + std::array b; + + template + buffer(T&&... t) + :string_view{stringify(b, std::forward(t)...)} + {} +}; + /// /// Convenience template for const rvalue mutable_buffers or basically /// allowing a bracket initialization of a mutable_buffer in the argument