// Matrix Construct // // Copyright (C) Matrix Construct Developers, Authors & Contributors // Copyright (C) 2016-2018 Jason Volk // // Permission to use, copy, modify, and/or distribute this software for any // purpose with or without fee is hereby granted, provided that the above // copyright notice and this permission notice is present in all copies. The // full license for this software is available in the LICENSE file. #pragma once #define HAVE_IRCD_BUFFER_CONST_BUFFER_H struct ircd::buffer::const_buffer :buffer { // Definition for this is somewhere in the .cc files where boost is incl. operator boost::asio::const_buffer() const; // For boost::spirit conceptual compliance; illegal/noop void insert(const char *const &, const char &); using buffer::buffer; template const_buffer(const char (&buf)[SIZE]); template const_buffer(const std::array &buf); const_buffer(const buffer &b); const_buffer(const buffer &b); const_buffer(const mutable_buffer &b); const_buffer(const string_view &s); const_buffer() = default; }; inline ircd::buffer::const_buffer::const_buffer(const buffer &b) :buffer{b} {} inline ircd::buffer::const_buffer::const_buffer(const buffer &b) :buffer{data(b), size(b)} {} inline ircd::buffer::const_buffer::const_buffer(const mutable_buffer &b) :buffer{data(b), size(b)} {} inline ircd::buffer::const_buffer::const_buffer(const string_view &s) :buffer{data(s), size(s)} {} template ircd::buffer::const_buffer::const_buffer(const char (&buf)[SIZE]) :buffer{buf, SIZE} {} template ircd::buffer::const_buffer::const_buffer(const std::array &buf) :buffer{reinterpret_cast(buf.data()), SIZE} {} #ifndef _NDEBUG __attribute__((noreturn)) #endif inline void ircd::buffer::const_buffer::insert(const char *const &, const char &) { assert(0); }