libjmmcg
release_579_6_g8cffd
A C++ library containing an eclectic mix of useful, advanced components.
|
A very simple custom allocator that allocates a contiguous block of uninitialised items on the stack. More...
#include <memory_buffer.hpp>
Public Types | |
enum | : std::size_t { stride =sizeof(element_type) , max_size_ =num_objs } |
typedef El | element_type |
The type of items to allocate, but not initialise. More... | |
typedef std::size_t | size_type |
typedef unsigned char const * | const_iterator |
typedef unsigned char * | iterator |
Public Member Functions | |
BOOST_MPL_ASSERT ((boost::mpl::greater< boost::mpl::int_< num_objs >, boost::mpl::int_< 0 >>)) | |
BOOST_MPL_ASSERT ((boost::mpl::greater< boost::mpl::int_< stride >, boost::mpl::int_< 0 >>)) | |
BOOST_MPL_ASSERT ((boost::mpl::greater< boost::mpl::int_< max_size_ >, boost::mpl::int_< 0 >>)) | |
memory_buffer () noexcept(true) FORCE_INLINE | |
~memory_buffer () noexcept(true) FORCE_INLINE | |
const_iterator | data () const noexcept(true) FORCE_INLINE |
iterator | data () noexcept(true) FORCE_INLINE |
Static Public Member Functions | |
static constexpr size_type | max_size () noexcept(true) FORCE_INLINE |
Friends | |
tostream & | operator<< (tostream &os, memory_buffer const &t) noexcept(false) |
A very simple custom allocator that allocates a contiguous block of uninitialised items on the stack.
A simple char[] does not respect alignment, whereas this class ensures that the objects are suitably aligned. Note that the items allocated are guaranteed not to be initialised, which is how this differs from std::array, which, as I understand it, must default-initialise each std::array::value_type member according to 8.5.1p7 of the ISO Standard.
Definition at line 141 of file memory_buffer.hpp.
typedef unsigned char const* jmmcg::LIBJMMCG_VER_NAMESPACE::stack::memory_buffer< El, num_objs >::const_iterator |
Definition at line 161 of file memory_buffer.hpp.
typedef El jmmcg::LIBJMMCG_VER_NAMESPACE::stack::memory_buffer< El, num_objs >::element_type |
The type of items to allocate, but not initialise.
Definition at line 143 of file memory_buffer.hpp.
typedef unsigned char* jmmcg::LIBJMMCG_VER_NAMESPACE::stack::memory_buffer< El, num_objs >::iterator |
Definition at line 162 of file memory_buffer.hpp.
typedef std::size_t jmmcg::LIBJMMCG_VER_NAMESPACE::stack::memory_buffer< El, num_objs >::size_type |
Definition at line 160 of file memory_buffer.hpp.
anonymous enum : std::size_t |
Enumerator | |
---|---|
stride | The sizeof(element_type) each item, specifically in bytes. |
max_size_ | The size of the buffer in number of items. |
Definition at line 150 of file memory_buffer.hpp.
|
inlinenoexcept |
Definition at line 164 of file memory_buffer.hpp.
|
inlinenoexcept |
Definition at line 167 of file memory_buffer.hpp.
jmmcg::LIBJMMCG_VER_NAMESPACE::stack::memory_buffer< El, num_objs >::BOOST_MPL_ASSERT | ( | (boost::mpl::greater< boost::mpl::int_< max_size_ >, boost::mpl::int_< 0 >>) | ) |
jmmcg::LIBJMMCG_VER_NAMESPACE::stack::memory_buffer< El, num_objs >::BOOST_MPL_ASSERT | ( | (boost::mpl::greater< boost::mpl::int_< num_objs >, boost::mpl::int_< 0 >>) | ) |
jmmcg::LIBJMMCG_VER_NAMESPACE::stack::memory_buffer< El, num_objs >::BOOST_MPL_ASSERT | ( | (boost::mpl::greater< boost::mpl::int_< stride >, boost::mpl::int_< 0 >>) | ) |
|
inlinenoexcept |
Definition at line 169 of file memory_buffer.hpp.
|
inlinenoexcept |
Definition at line 172 of file memory_buffer.hpp.
|
inlinestaticconstexprnoexcept |
Definition at line 179 of file memory_buffer.hpp.
References jmmcg::LIBJMMCG_VER_NAMESPACE::stack::memory_buffer< El, num_objs >::max_size_.
|
friend |
Definition at line 186 of file memory_buffer.hpp.