diff options
Diffstat (limited to 'boost/container/detail/node_pool_impl.hpp')
-rw-r--r-- | boost/container/detail/node_pool_impl.hpp | 31 |
1 files changed, 20 insertions, 11 deletions
diff --git a/boost/container/detail/node_pool_impl.hpp b/boost/container/detail/node_pool_impl.hpp index 2450e5103e..4febf19e90 100644 --- a/boost/container/detail/node_pool_impl.hpp +++ b/boost/container/detail/node_pool_impl.hpp @@ -7,26 +7,31 @@ // See http://www.boost.org/libs/container for documentation. // ////////////////////////////////////////////////////////////////////////////// - #ifndef BOOST_CONTAINER_DETAIL_NODE_POOL_IMPL_HPP #define BOOST_CONTAINER_DETAIL_NODE_POOL_IMPL_HPP -#if defined(_MSC_VER) +#ifndef BOOST_CONFIG_HPP +# include <boost/config.hpp> +#endif + +#if defined(BOOST_HAS_PRAGMA_ONCE) # pragma once #endif #include <boost/container/detail/config_begin.hpp> #include <boost/container/detail/workaround.hpp> - #include <boost/container/container_fwd.hpp> -#include <boost/container/detail/utilities.hpp> -#include <boost/intrusive/pointer_traits.hpp> -#include <boost/intrusive/set.hpp> -#include <boost/intrusive/slist.hpp> -#include <boost/container/detail/type_traits.hpp> + #include <boost/container/detail/math_functions.hpp> #include <boost/container/detail/mpl.hpp> #include <boost/container/detail/pool_common.hpp> +#include <boost/container/detail/to_raw_pointer.hpp> +#include <boost/container/detail/type_traits.hpp> + +#include <boost/intrusive/pointer_traits.hpp> +#include <boost/intrusive/set.hpp> +#include <boost/intrusive/slist.hpp> + #include <boost/core/no_exceptions_support.hpp> #include <boost/assert.hpp> #include <cstddef> @@ -57,6 +62,10 @@ class private_node_pool_impl < node_t, bi::base_hook<slist_hook_t> , bi::linear<true> , bi::constant_time_size<false> >::type blockslist_t; + + static size_type get_rounded_size(size_type orig_size, size_type round_to) + { return ((orig_size-1)/round_to+1)*round_to; } + public: //!Segment manager typedef @@ -145,7 +154,7 @@ class private_node_pool_impl nodelist_iterator backup_list_last = backup_list.before_begin(); //Execute the algorithm and get an iterator to the last value - size_type blocksize = get_rounded_size + size_type blocksize = (get_rounded_size) (m_real_node_size*m_nodes_per_block, (size_type) alignment_of<node_t>::value); while(it != itend){ @@ -205,7 +214,7 @@ class private_node_pool_impl { //check for memory leaks BOOST_ASSERT(m_allocated==0); - size_type blocksize = get_rounded_size + size_type blocksize = (get_rounded_size) (m_real_node_size*m_nodes_per_block, (size_type)alignment_of<node_t>::value); //We iterate though the NodeBlock list to free the memory @@ -298,7 +307,7 @@ class private_node_pool_impl { BOOST_ASSERT(num_blocks > 0); size_type blocksize = - get_rounded_size(m_real_node_size*m_nodes_per_block, (size_type)alignment_of<node_t>::value); + (get_rounded_size)(m_real_node_size*m_nodes_per_block, (size_type)alignment_of<node_t>::value); BOOST_TRY{ for(size_type i = 0; i != num_blocks; ++i){ |