Reference documentation for deal.II version 9.4.1
\(\newcommand{\dealvcentcolon}{\mathrel{\mathop{:}}}\) \(\newcommand{\dealcoloneq}{\dealvcentcolon\mathrel{\mkern-1.2mu}=}\) \(\newcommand{\jump}[1]{\left[\!\left[ #1 \right]\!\right]}\) \(\newcommand{\average}[1]{\left\{\!\left\{ #1 \right\}\!\right\}}\)
No Matches
Public Member Functions | Public Attributes | List of all members

#include <deal.II/lac/vector_memory.h>

Inheritance diagram for VectorMemory< VectorType >::Pointer:

Public Member Functions

 Pointer ()=default
 Pointer (Pointer &&p) noexcept=default
Pointeroperator= (Pointer &&p) noexcept=default
 Pointer (VectorMemory< VectorType > &mem)
 ~Pointer ()=default
T * operator-> ()
 STL member. More...

Public Attributes

 STL member. More...

Detailed Description

template<typename VectorType = ::Vector<double>>
class VectorMemory< VectorType >::Pointer

A class that looks like a pointer for all practical purposes and that upon construction time allocates a vector from a VectorMemory object (or an object of a class derived from VectorMemory) that is passed to the constructor of this class. The destructor then automatically returns the vector's ownership to the same VectorMemory object.

Pointers of this type are therefore safe in the sense that they automatically call VectorMemory::free() when they are destroyed, whether that happens at the end of a code block or because local variables are destroyed during exception unwinding. These kinds of object thus relieve the user from using vector management functions explicitly.

In many senses, this class acts like std::unique_ptr in that it is the unique owner of a chunk of memory that it frees upon destruction. The main differences to std::unique_ptr are (i) that it allocates memory from a memory pool upon construction, and (ii) that the memory is not destroyed using operator delete but returned to the VectorMemory pool.

Definition at line 187 of file vector_memory.h.

Member Function Documentation

◆ operator->()

T* std::unique_ptr< T >::operator->

STL member.

Member Data Documentation

◆ ptr

T std::unique_ptr< T >::ptr

STL member.

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