diff --git a/include/boost/interprocess/detail/segment_manager_helper.hpp b/include/boost/interprocess/detail/segment_manager_helper.hpp index 46f872d..8c4efbd 100644 --- a/include/boost/interprocess/detail/segment_manager_helper.hpp +++ b/include/boost/interprocess/detail/segment_manager_helper.hpp @@ -129,21 +129,11 @@ struct block_header unsigned short name_length() const { return m_num_char; } - size_type name_offset() const - { - return this->value_offset() + get_rounded_size(size_type(m_value_bytes), size_type(sizeof_char())); - } - void *value() const { return const_cast((reinterpret_cast(this) + this->value_offset())); } - size_type value_offset() const - { - return get_rounded_size(size_type(sizeof(block_header)), size_type(m_value_alignment)); - } - template static block_header *block_header_from_value(T *value) { @@ -185,6 +175,17 @@ struct block_header //Some sanity checks return hdr; } + + private: + size_type value_offset() const + { + return get_rounded_size(size_type(sizeof(block_header)), size_type(m_value_alignment)); + } + + size_type name_offset() const + { + return this->value_offset() + get_rounded_size(size_type(m_value_bytes), size_type(sizeof_char())); + } }; template @@ -247,15 +248,6 @@ struct intrusive_value_type_impl intrusive_value_type_impl(){} - block_header_t *get_block_header() - { return block_header_t::from_first_header(this); } - - const block_header_t *get_block_header() const - { return block_header_t::from_first_header(this); } - - static intrusive_value_type_impl *get_intrusive_value_type(block_header_t *hdr) - { return block_header_t::template to_first_header(hdr); } - CharType *name() const { return get_block_header()->template name(); } @@ -264,6 +256,10 @@ struct intrusive_value_type_impl void *value() const { return get_block_header()->value(); } + + private: + const block_header_t *get_block_header() const + { return block_header_t::from_first_header(this); } }; template diff --git a/include/boost/interprocess/indexes/iunordered_set_index.hpp b/include/boost/interprocess/indexes/iunordered_set_index.hpp index fa0ddba..fd830d1 100644 --- a/include/boost/interprocess/indexes/iunordered_set_index.hpp +++ b/include/boost/interprocess/indexes/iunordered_set_index.hpp @@ -113,7 +113,7 @@ struct iunordered_set_index_aux std::size_t operator()(const compare_key_type&i) const { const char_type *beg = i.mp_str, - *end = beg + i.m_len; + *end = beg + i.m_len; return hash_char_range(beg, end); } }; diff --git a/include/boost/interprocess/segment_manager.hpp b/include/boost/interprocess/segment_manager.hpp index 3f16a23..769c831 100644 --- a/include/boost/interprocess/segment_manager.hpp +++ b/include/boost/interprocess/segment_manager.hpp @@ -868,7 +868,7 @@ class segment_manager typedef IndexType > index_t; typedef typename index_t::index_data_t index_data_t; - index_data_t *si = priv_index_header_from_block(block_header, is_intrusive_t()); + index_data_t* si = block_header_t::template to_first_header(block_header); return this->priv_generic_named_destroy_impl(*si, index); } @@ -927,7 +927,7 @@ class segment_manager void *memory; BOOST_IF_CONSTEXPR(is_node_index_t::value || is_intrusive_t::value){ - index_data_t*ihdr = priv_index_header_from_block(ctrl_data, is_intrusive_t()); + index_data_t*ihdr = block_header_t::template to_first_header(ctrl_data); ihdr->~index_data_t(); memory = ihdr; } @@ -957,19 +957,6 @@ class segment_manager return static_cast(ipcdetail::to_raw_pointer(it->second.m_ptr)); } - template - static typename IndexT::index_data_t * priv_index_header_from_block(block_header_t *bh, ipcdetail::true_) //is_intrusive - { - return IndexT::index_data_t::get_intrusive_value_type(bh); - } - - template - static typename IndexT::index_data_t * priv_index_header_from_block(block_header_t* bh, ipcdetail::false_) //!is_intrusive - { - return block_header_t::template to_first_header - (bh); - } - //!Generic named new function for //!named functions template