Boost C++ Libraries Home Libraries People FAQ More

PrevUpHomeNext

Struct devector_growth_policy

boost::container::devector_growth_policy

Synopsis

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


struct devector_growth_policy {

  // public static functions
  template<typename SizeType> static SizeType new_capacity(SizeType);
  template<typename SizeType> 
    static bool should_shrink(SizeType, SizeType, SizeType);
};

Description

Controls a devectors reallocation policy.

Models the GrowthPolicy concept of the devector class.

devector_growth_policy public static functions

  1. template<typename SizeType> static SizeType new_capacity(SizeType capacity);

    Returns: 4 times the old capacity or 16 if it's 0.

    Parameters:

    capacity

    The current capacity of the devector, equals to capacity().

  2. template<typename SizeType> 
      static bool should_shrink(SizeType size, SizeType capacity, 
                                SizeType small_buffer_size);

    Returns: true, if the contents fit in the small buffer.

    Parameters:

    capacity

    The current capacity of the devector, equals to capacity().

    size

    The element count of the devector, equals to size()

    small_buffer_size

    The size of the small buffer, specified by the SmallBufferPolicy.


PrevUpHomeNext