| Home | Libraries | People | FAQ | More

## Struct template growth_factor

boost::container::growth_factor

## 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.

The GrowthFactor function object must offer the following interface:

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

Where:

- `cur_cap` is the current capacity

- `add_min_cap` is the minimum additional capacity we want to achieve

- `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`. The implementation should handle the potential wraparound produced by the growth factor and always succeed with a correct value.

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

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

### Template Parameters

1.     typename GrowthFactor

   The function object that implements the growth factor