forked from boostorg/container
Use BOOST_STATIC_CONSTEXPR where applicable
This commit is contained in:
1 parent
8217bc03bb
commit
0977e6b1d4
46 files changed
+233
-230
No files matched your search
@@ -213,11 +213,11 @@ template<class MultiallocationChain, class VoidPointer, class SizeType, unsigned
|
||||
struct adaptive_pool_types
|
||||
{
|
||||
typedef VoidPointer void_pointer;
|
||||
static const unsigned ordered = (Flags & (adaptive_pool_flag::size_ordered | adaptive_pool_flag::address_ordered));
|
||||
BOOST_STATIC_CONSTEXPR unsigned ordered = (Flags & (adaptive_pool_flag::size_ordered | adaptive_pool_flag::address_ordered));
|
||||
typedef block_container_traits<VoidPointer, SizeType, ordered> block_container_traits_t;
|
||||
typedef typename block_container_traits_t::hook_t hook_t;
|
||||
typedef hdr_offset_holder_t<SizeType> hdr_offset_holder;
|
||||
static const unsigned int order_flags = Flags & (adaptive_pool_flag::size_ordered | adaptive_pool_flag::address_ordered);
|
||||
BOOST_STATIC_CONSTEXPR unsigned int order_flags = Flags & (adaptive_pool_flag::size_ordered | adaptive_pool_flag::address_ordered);
|
||||
typedef MultiallocationChain free_nodes_t;
|
||||
|
||||
struct block_info_t
|
||||
@@ -253,11 +253,11 @@ template< std::size_t alignment
|
||||
, std::size_t overhead_percent>
|
||||
struct candidate_power_of_2_ct_helper
|
||||
{
|
||||
static const std::size_t hdr_subblock_elements_alone = (alignment - hdr_size - payload_per_allocation)/real_node_size;
|
||||
static const std::size_t hdr_subblock_elements_first = (alignment - hdr_size - payload_per_allocation)/real_node_size;
|
||||
static const std::size_t elements_per_b_subblock_mid = (alignment - hdr_offset_size)/real_node_size;
|
||||
static const std::size_t elements_per_b_subblock_end = (alignment - hdr_offset_size - payload_per_allocation)/real_node_size;
|
||||
static const std::size_t num_b_subblock =
|
||||
BOOST_STATIC_CONSTEXPR std::size_t hdr_subblock_elements_alone = (alignment - hdr_size - payload_per_allocation)/real_node_size;
|
||||
BOOST_STATIC_CONSTEXPR std::size_t hdr_subblock_elements_first = (alignment - hdr_size - payload_per_allocation)/real_node_size;
|
||||
BOOST_STATIC_CONSTEXPR std::size_t elements_per_b_subblock_mid = (alignment - hdr_offset_size)/real_node_size;
|
||||
BOOST_STATIC_CONSTEXPR std::size_t elements_per_b_subblock_end = (alignment - hdr_offset_size - payload_per_allocation)/real_node_size;
|
||||
BOOST_STATIC_CONSTEXPR std::size_t num_b_subblock =
|
||||
hdr_subblock_elements_alone >= min_elements_per_block
|
||||
? 0
|
||||
: ( ((hdr_subblock_elements_first + elements_per_b_subblock_end) >= min_elements_per_block)
|
||||
@@ -266,18 +266,18 @@ struct candidate_power_of_2_ct_helper
|
||||
)
|
||||
;
|
||||
|
||||
static const std::size_t num_b_subblock_mid = (num_b_subblock > 1) ? (num_b_subblock - 1) : 0;
|
||||
BOOST_STATIC_CONSTEXPR std::size_t num_b_subblock_mid = (num_b_subblock > 1) ? (num_b_subblock - 1) : 0;
|
||||
|
||||
static const std::size_t total_nodes = (num_b_subblock == 0)
|
||||
BOOST_STATIC_CONSTEXPR std::size_t total_nodes = (num_b_subblock == 0)
|
||||
? hdr_subblock_elements_alone
|
||||
: ( (num_b_subblock == 1)
|
||||
? (hdr_subblock_elements_first + elements_per_b_subblock_end)
|
||||
: (hdr_subblock_elements_first + num_b_subblock_mid*elements_per_b_subblock_mid + elements_per_b_subblock_end)
|
||||
)
|
||||
;
|
||||
static const std::size_t total_data = total_nodes*real_node_size;
|
||||
static const std::size_t total_size = alignment*(num_b_subblock+1);
|
||||
static const bool overhead_satisfied = (total_size - total_data)*100/total_size < overhead_percent;
|
||||
BOOST_STATIC_CONSTEXPR std::size_t total_data = total_nodes*real_node_size;
|
||||
BOOST_STATIC_CONSTEXPR std::size_t total_size = alignment*(num_b_subblock+1);
|
||||
BOOST_STATIC_CONSTEXPR bool overhead_satisfied = (total_size - total_data)*100/total_size < overhead_percent;
|
||||
};
|
||||
|
||||
template< std::size_t initial_alignment
|
||||
@@ -299,7 +299,7 @@ struct candidate_power_of_2_ct
|
||||
, hdr_offset_size
|
||||
, overhead_percent> helper_t;
|
||||
|
||||
static const std::size_t candidate_power_of_2 = initial_alignment << std::size_t(!helper_t::overhead_satisfied);
|
||||
BOOST_STATIC_CONSTEXPR std::size_t candidate_power_of_2 = initial_alignment << std::size_t(!helper_t::overhead_satisfied);
|
||||
|
||||
typedef typename candidate_power_of_2_ct
|
||||
< candidate_power_of_2
|
||||
@@ -312,9 +312,9 @@ struct candidate_power_of_2_ct
|
||||
, !helper_t::overhead_satisfied
|
||||
>::type type;
|
||||
|
||||
static const std::size_t alignment = type::alignment;
|
||||
static const std::size_t num_subblocks = type::num_subblocks;
|
||||
static const std::size_t real_num_node = type::real_num_node;
|
||||
BOOST_STATIC_CONSTEXPR std::size_t alignment = type::alignment;
|
||||
BOOST_STATIC_CONSTEXPR std::size_t num_subblocks = type::num_subblocks;
|
||||
BOOST_STATIC_CONSTEXPR std::size_t real_num_node = type::real_num_node;
|
||||
};
|
||||
|
||||
template< std::size_t initial_alignment
|
||||
@@ -354,9 +354,9 @@ struct candidate_power_of_2_ct
|
||||
, hdr_offset_size
|
||||
, overhead_percent> helper_t;
|
||||
|
||||
static const std::size_t alignment = initial_alignment;
|
||||
static const std::size_t num_subblocks = helper_t::num_b_subblock+1;
|
||||
static const std::size_t real_num_node = helper_t::total_nodes;
|
||||
BOOST_STATIC_CONSTEXPR std::size_t alignment = initial_alignment;
|
||||
BOOST_STATIC_CONSTEXPR std::size_t num_subblocks = helper_t::num_b_subblock+1;
|
||||
BOOST_STATIC_CONSTEXPR std::size_t real_num_node = helper_t::total_nodes;
|
||||
};
|
||||
|
||||
/////////////////////////////////////////////
|
||||
@@ -429,13 +429,13 @@ class private_adaptive_node_pool_impl_common
|
||||
typedef typename SegmentManagerBase::size_type size_type;
|
||||
//Flags
|
||||
//align_only
|
||||
static const bool AlignOnly = (Flags & adaptive_pool_flag::align_only) != 0;
|
||||
BOOST_STATIC_CONSTEXPR bool AlignOnly = (Flags & adaptive_pool_flag::align_only) != 0;
|
||||
typedef bool_<AlignOnly> IsAlignOnly;
|
||||
typedef true_ AlignOnlyTrue;
|
||||
typedef false_ AlignOnlyFalse;
|
||||
|
||||
typedef typename SegmentManagerBase::void_pointer void_pointer;
|
||||
static const typename SegmentManagerBase::
|
||||
BOOST_STATIC_CONSTEXPR typename SegmentManagerBase::
|
||||
size_type PayloadPerAllocation = SegmentManagerBase::PayloadPerAllocation;
|
||||
|
||||
typedef typename boost::intrusive::pointer_traits
|
||||
@@ -453,9 +453,9 @@ class private_adaptive_node_pool_impl_common
|
||||
typedef typename adaptive_pool_types_t::hdr_offset_holder hdr_offset_holder;
|
||||
typedef private_adaptive_node_pool_impl_common this_type;
|
||||
|
||||
static const size_type MaxAlign = alignment_of<void_pointer>::value;
|
||||
static const size_type HdrSize = ((sizeof(block_info_t)-1)/MaxAlign+1)*MaxAlign;
|
||||
static const size_type HdrOffsetSize = ((sizeof(hdr_offset_holder)-1)/MaxAlign+1)*MaxAlign;
|
||||
BOOST_STATIC_CONSTEXPR size_type MaxAlign = alignment_of<void_pointer>::value;
|
||||
BOOST_STATIC_CONSTEXPR size_type HdrSize = ((sizeof(block_info_t)-1)/MaxAlign+1)*MaxAlign;
|
||||
BOOST_STATIC_CONSTEXPR size_type HdrOffsetSize = ((sizeof(hdr_offset_holder)-1)/MaxAlign+1)*MaxAlign;
|
||||
|
||||
segment_mngr_base_ptr_t mp_segment_mngr_base; //Segment manager
|
||||
block_container_t m_block_container; //Intrusive block list
|
||||
@@ -981,9 +981,9 @@ template< class SizeType
|
||||
, bool AlignOnly>
|
||||
struct calculate_alignment_ct
|
||||
{
|
||||
static const std::size_t alignment = upper_power_of_2_ct<SizeType, HdrSize + RealNodeSize*NodesPerBlock>::value;
|
||||
static const std::size_t num_subblocks = 0;
|
||||
static const std::size_t real_num_node = (alignment - PayloadPerAllocation - HdrSize)/RealNodeSize;
|
||||
BOOST_STATIC_CONSTEXPR std::size_t alignment = upper_power_of_2_ct<SizeType, HdrSize + RealNodeSize*NodesPerBlock>::value;
|
||||
BOOST_STATIC_CONSTEXPR std::size_t num_subblocks = 0;
|
||||
BOOST_STATIC_CONSTEXPR std::size_t real_num_node = (alignment - PayloadPerAllocation - HdrSize)/RealNodeSize;
|
||||
};
|
||||
|
||||
template< class SizeType
|
||||
@@ -1013,9 +1013,9 @@ struct calculate_alignment_ct
|
||||
, OverheadPercent
|
||||
>::type type;
|
||||
|
||||
static const std::size_t alignment = type::alignment;
|
||||
static const std::size_t num_subblocks = type::num_subblocks;
|
||||
static const std::size_t real_num_node = type::real_num_node;
|
||||
BOOST_STATIC_CONSTEXPR std::size_t alignment = type::alignment;
|
||||
BOOST_STATIC_CONSTEXPR std::size_t num_subblocks = type::num_subblocks;
|
||||
BOOST_STATIC_CONSTEXPR std::size_t real_num_node = type::real_num_node;
|
||||
};
|
||||
|
||||
|
||||
@@ -1046,17 +1046,17 @@ class private_adaptive_node_pool_impl_ct
|
||||
typedef typename base_t::multiallocation_chain multiallocation_chain;
|
||||
typedef typename base_t::segment_manager_base_type segment_manager_base_type;
|
||||
|
||||
static const typename base_t::size_type PayloadPerAllocation = base_t::PayloadPerAllocation;
|
||||
BOOST_STATIC_CONSTEXPR typename base_t::size_type PayloadPerAllocation = base_t::PayloadPerAllocation;
|
||||
|
||||
//align_only
|
||||
static const bool AlignOnly = base_t::AlignOnly;
|
||||
BOOST_STATIC_CONSTEXPR bool AlignOnly = base_t::AlignOnly;
|
||||
|
||||
private:
|
||||
static const size_type MaxAlign = base_t::MaxAlign;
|
||||
static const size_type HdrSize = base_t::HdrSize;
|
||||
static const size_type HdrOffsetSize = base_t::HdrOffsetSize;
|
||||
BOOST_STATIC_CONSTEXPR size_type MaxAlign = base_t::MaxAlign;
|
||||
BOOST_STATIC_CONSTEXPR size_type HdrSize = base_t::HdrSize;
|
||||
BOOST_STATIC_CONSTEXPR size_type HdrOffsetSize = base_t::HdrOffsetSize;
|
||||
|
||||
static const size_type RealNodeSize = lcm_ct<NodeSize, alignment_of<void_pointer>::value>::value;
|
||||
BOOST_STATIC_CONSTEXPR size_type RealNodeSize = lcm_ct<NodeSize, alignment_of<void_pointer>::value>::value;
|
||||
|
||||
typedef calculate_alignment_ct
|
||||
< size_type, HdrSize, PayloadPerAllocation
|
||||
@@ -1065,9 +1065,9 @@ class private_adaptive_node_pool_impl_ct
|
||||
//Round the size to a power of two value.
|
||||
//This is the total memory size (including payload) that we want to
|
||||
//allocate from the general-purpose allocator
|
||||
static const size_type NumSubBlocks = data_t::num_subblocks;
|
||||
static const size_type RealNumNode = data_t::real_num_node;
|
||||
static const size_type RealBlockAlignment = data_t::alignment;
|
||||
BOOST_STATIC_CONSTEXPR size_type NumSubBlocks = data_t::num_subblocks;
|
||||
BOOST_STATIC_CONSTEXPR size_type RealNumNode = data_t::real_num_node;
|
||||
BOOST_STATIC_CONSTEXPR size_type RealBlockAlignment = data_t::alignment;
|
||||
|
||||
public:
|
||||
|
||||
@@ -1165,14 +1165,14 @@ class private_adaptive_node_pool_impl_rt
|
||||
typedef typename impl_t::size_type size_type;
|
||||
typedef typename impl_t::multiallocation_chain multiallocation_chain;
|
||||
|
||||
static const typename impl_t::size_type PayloadPerAllocation = impl_t::PayloadPerAllocation;
|
||||
BOOST_STATIC_CONSTEXPR typename impl_t::size_type PayloadPerAllocation = impl_t::PayloadPerAllocation;
|
||||
|
||||
//Flags
|
||||
//align_only
|
||||
static const bool AlignOnly = impl_t::AlignOnly;
|
||||
BOOST_STATIC_CONSTEXPR bool AlignOnly = impl_t::AlignOnly;
|
||||
|
||||
static const size_type HdrSize = impl_t::HdrSize;
|
||||
static const size_type HdrOffsetSize = impl_t::HdrOffsetSize;
|
||||
BOOST_STATIC_CONSTEXPR size_type HdrSize = impl_t::HdrSize;
|
||||
BOOST_STATIC_CONSTEXPR size_type HdrOffsetSize = impl_t::HdrOffsetSize;
|
||||
|
||||
public:
|
||||
|
||||
|
||||
Reference in new issue
Block a user