diff --git a/include/ircd/buffer/buffer.h b/include/ircd/buffer/buffer.h index e70d13274..2aff49e3b 100644 --- a/include/ircd/buffer/buffer.h +++ b/include/ircd/buffer/buffer.h @@ -39,6 +39,7 @@ namespace ircd::buffer struct window_buffer; template struct fixed_buffer; template struct unique_buffer; + template struct shared_buffer; template using fixed_const_buffer = fixed_buffer; template using fixed_mutable_buffer = fixed_buffer; @@ -89,6 +90,7 @@ namespace ircd::buffer #include "fixed_buffer.h" #include "window_buffer.h" #include "unique_buffer.h" +#include "shared_buffer.h" // Export these important aliases down to main ircd namespace namespace ircd @@ -97,6 +99,7 @@ namespace ircd using buffer::mutable_buffer; using buffer::fixed_buffer; using buffer::unique_buffer; + using buffer::shared_buffer; using buffer::null_buffer; using buffer::window_buffer; using buffer::fixed_const_buffer; diff --git a/include/ircd/buffer/shared_buffer.h b/include/ircd/buffer/shared_buffer.h new file mode 100644 index 000000000..1386cb557 --- /dev/null +++ b/include/ircd/buffer/shared_buffer.h @@ -0,0 +1,33 @@ +// 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_SHARED_BUFFER_H + +template +struct ircd::buffer::shared_buffer +:std::shared_ptr +,buffer +{ + shared_buffer(const size_t &size); + shared_buffer() = default; +}; + +template +ircd::buffer::shared_buffer::shared_buffer(const size_t &size) +:std::shared_ptr +{ + std::make_shared(size) +} +,buffer +{ + std::shared_ptr::get(), size +} +{}