Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for an old version of Boost. Click here to view this page for the latest version.
PrevUpHomeNext

Struct template growth_factor

boost::container::growth_factor — defined(BOOST_CONTAINER_DOXYGEN_INVOKED)

Synopsis

// In header: <boost/container/options.hpp>

template<typename GrowthFactor> 
struct growth_factor {
};

Description

This option setter specifies the growth factor strategy of the underlying vector.

Predefined growth factors that can be passed as arguments to this option are: boost::container::growth_factor_50 boost::container::growth_factor_60 boost::container::growth_factor_100

If this option is not specified, a default will be used by the container.

Template Parameters

  1. typename GrowthFactor

    A function object that has the following signature:

    template<class SizeType>
    SizeType operator()(SizeType cur_cap, SizeType add_min_cap, SizeType max_cap) const;.

    cur_cap is the current capacity, add_min_cap is the minimum additional capacity we want to achieve and max_cap is the maximum capacity that the allocator or other factors allow. The implementation should return a value between cur_cap + add_min_cap and max_cap. cur_cap + add_min_cap is guaranteed not to overflow/wraparound, but the implementation should handle wraparound produced by the growth factor.


PrevUpHomeNext