![]() |
Optimal growth policy class.The OptimalGrowth policy class implements the optimal growth strategy suggested by Andrew Koenig for the std::vector class (see Andrew Koenig's column in the September 1998 issue of JOOP (Journal of Object-Oriented Programming), or the Dr. Dobb's article 'C++ Made Easier: How Vectors Grow', 2001). It applies an exponential growth strategy using a factor of 1.5 and additionally ensures that the sizes returns are always multiples of four. More...
#include <OptimalGrowth.h>
Public Member Functions | |
Utility functions | |
size_t | operator() (size_t oldSize, size_t minSize) const |
Returns a new size depending on the given old size and the required minimum size. | |
Optimal growth policy class.
The OptimalGrowth policy class implements the optimal growth strategy suggested by Andrew Koenig for the std::vector class (see Andrew Koenig's column in the September 1998 issue of JOOP (Journal of Object-Oriented Programming), or the Dr. Dobb's article 'C++ Made Easier: How Vectors Grow', 2001). It applies an exponential growth strategy using a factor of 1.5 and additionally ensures that the sizes returns are always multiples of four.
Returns a new size depending on the given old size and the required minimum size.
old | The old size. |
minimum | The required minimum size. |