1 #ifndef LIBJMMCG_CORE_MEMORY_BUFFER_HPP
2 #define LIBJMMCG_CORE_MEMORY_BUFFER_HPP
23 #include <boost/mpl/assert.hpp>
24 #include <boost/mpl/comparison.hpp>
25 #include <boost/mpl/greater.hpp>
26 #include <boost/mpl/int.hpp>
29 #include <type_traits>
68 if (!buff_info.first || buff_info.second<num_objs) {
79 assert(std::fill_n(data(), stride*max_size(),
static_cast<
unsigned char>(0)));
82 std::return_temporary_buffer(buff_info.first);
100 return reinterpret_cast<
iterator>(buff_info.first);
107 return buff_info.second;
116 <<
_T(
"buffer address=0x")<<
std::hex<<t.data()
117 <<
_T(
", size=")<<
std::dec<<t.max_size()
123 const buff_info_t buff_info;
147 typedef aligned_type buff_info_t[num_objs];
155 BOOST_MPL_ASSERT((
boost::mpl::greater<
boost::mpl::int_<num_objs>,
boost::mpl::int_<0>>));
165 assert(std::fill_n(data(), stride*max_size(),
static_cast<
unsigned char>(0)));
173 return reinterpret_cast<
iterator>(buff_info);
189 <<
_T(
"buffer address=0x")<<
std::hex<<t.data()
190 <<
_T(
", size=")<<
std::dec<<t.max_size()
196 buff_info_t buff_info;