utilities  0.0
Public Member Functions | Public Attributes | List of all members
molpro::pointer_holder< T, _Alloc > Class Template Reference

A template for a container class like std::vector<T> but with the following features. More...

#include <memory.h>

Public Member Functions

 pointer_holder (T *const ptr)
 

Public Attributes

T * m_ptr
 

Detailed Description

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.

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
TType of the elements of the array.
_AllocAllocator for T

Example:

#include "memory.h"
int main() {
{
for (size_t i=0; i<arr.size(); i++) arr[i]=100*i;
for (molpro::vector<>::iterator el=arr.begin(); el!=arr.end(); el++)
std::cout << "array element "<<*el<<std::endl;
} // arr will release its buffer and be destroyed on going out of scope
return 0; }
Definition: memory.h:439
Definition: memory.h:279
size_t memory_initialize(char *buffer, size_t max)
Definition: memory.h:104

Constructor & Destructor Documentation

◆ pointer_holder()

template<typename T = double, typename _Alloc = molpro::allocator<T>>
molpro::pointer_holder< T, _Alloc >::pointer_holder ( T *const  ptr)
inline

Member Data Documentation

◆ m_ptr

template<typename T = double, typename _Alloc = molpro::allocator<T>>
T* molpro::pointer_holder< T, _Alloc >::m_ptr

The documentation for this class was generated from the following file: