Discontinuous Galerkin Library
#include "dg/algorithm.h"

a manager class that invokes the copy constructor on the managed ptr when copied (deep copy) More...

Public Member Functions

 Buffer ()
 new T More...
 
 Buffer (const T &t)
 new T(t) More...
 
 Buffer (const Buffer &src)
 
 Buffer (Buffer &&t)
 
Bufferoperator= (Buffer src)
 
 ~Buffer ()
 delete managed object More...
 
T & data () const
 Get write access to the data on the heap. More...
 

Friends

void swap (Buffer &first, Buffer &second)
 

Detailed Description

template<class T>
struct dg::Buffer< T >

a manager class that invokes the copy constructor on the managed ptr when copied (deep copy)

this class is most useful as a memory buffer for classes that need some workspace to fulfill their task but do otherwise not change their state. A buffer object can be declared const while the data it holds are still writeable.

Template Parameters
Tmust be default constructible and copyable

Constructor & Destructor Documentation

◆ Buffer() [1/4]

template<class T >
dg::Buffer< T >::Buffer ( )
inline

new T

◆ Buffer() [2/4]

template<class T >
dg::Buffer< T >::Buffer ( const T &  t)
inline

new T(t)

◆ Buffer() [3/4]

template<class T >
dg::Buffer< T >::Buffer ( const Buffer< T > &  src)
inline

◆ Buffer() [4/4]

template<class T >
dg::Buffer< T >::Buffer ( Buffer< T > &&  t)
inline

◆ ~Buffer()

template<class T >
dg::Buffer< T >::~Buffer ( )
inline

delete managed object

Member Function Documentation

◆ data()

template<class T >
T & dg::Buffer< T >::data ( ) const
inline

Get write access to the data on the heap.

Returns
a reference to the data object
Attention
never try to delete the returned reference

◆ operator=()

template<class T >
Buffer & dg::Buffer< T >::operator= ( Buffer< T >  src)
inline

Friends And Related Function Documentation

◆ swap

template<class T >
void swap ( Buffer< T > &  first,
Buffer< T > &  second 
)
friend

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