A template for a container class like std::vector<T> but with the following features.
More...
template<typename T = double, typename _Alloc = molpro::allocator<T>>
class molpro::pointer_holder< T, _Alloc >
A template for a container class like std::vector<T> but with the following features.
- the default allocator is molpro::allocator<T> which uses a managed stack. One should use resize() and reserve() with care, bearing in mind that memory allocation is from a stack. So if the array being resized is not at the top of the stack, and the resize causes it to grow, then it will be moved.
- The class is inheritable.
- A string representation function is provided for easy printing
Because the underlying implementation is std::vector<T>, then all elements of the array are constructed when constructing the array, leading to a construction time that is linear in the array size.
- Template Parameters
-
T | Type of the elements of the array. |
_Alloc | Allocator for T |
Example:
int main() {
{
for (size_t i=0; i<arr.size(); i++) arr[i]=100*i;
std::cout << "array element "<<*el<<std::endl;
}
return 0; }
size_t memory_initialize(char *buffer, size_t max)
Definition: memory.h:104