lean cpp library
A lean C++ library providing efficient utility classes for high-performance C++ applications.
|
Allows for custom move semantics on element reallocation. More...
#include <move_reallocation_policy.h>
Public Types | |
typedef Container::size_type | size_type |
Size type used by this policy class. | |
Static Public Member Functions | |
static void | reserve (Container &container, size_type newCapacity) |
Reserves memory for the specified number of elements, calling a custom move method for every element to be moved. | |
static void | pre_resize (Container &container, size_type newCount) |
Reserves a new block of memory, if the old block of memory can no longer serve the given new element count. |
Allows for custom move semantics on element reallocation.
This class implements special element reallocation behavior, calling a custom move method for every element to be moved rather than copy constructing all existing elements on reallocation.
static void lean::containers::move_reallocation_policy< Container, GrowthDenominator >::reserve | ( | Container & | container, |
size_type | newCapacity | ||
) | [inline, static] |
Reserves memory for the specified number of elements, calling a custom move method for every element to be moved.
Rather than copy constructing all existing elements into the new block of memory after reallocation, this method first performs default construction of all elements in the new range, issueing calls to a custom move method for each element in the old block of memory afterwards, passing the old elements as arguments to the move method of their corresponding new elements.