Helios++
Helios software for LiDAR simulations
PointerVector< T > Class Template Reference

Wrapper to have a vector of pointers such that when it is destroyed, all the pointers are deleted. More...

#include <PointerVector.h>

Public Member Functions

 PointerVector ()=default
 Default constructor.
 
 PointerVector (size_t const numElements)
 Constructor that initializes a shared vector to hold for numElements pointers. More...
 
virtual ~PointerVector ()
 Destructor that deletes what is hold for each pointer in the pointer vector before deleting the PointerVector itself.
 
std::vector< T * > & operator* ()
 Access a reference to the vector.
 
T * operator[] (size_t const i)
 

Protected Attributes

std::vector< T * > v
 The vector of pointers.
 

Detailed Description

template<typename T>
class PointerVector< T >

Wrapper to have a vector of pointers such that when it is destroyed, all the pointers are deleted.

Author
Alberto M. Esmoris Pena
Version
1.0

The shared vector can be safely accessed by different threads since it it is implemented to be concurrency-aware.

Template Parameters
TThe type of elements to which each pointer in the vector refers

Constructor & Destructor Documentation

◆ PointerVector()

template<typename T >
PointerVector< T >::PointerVector ( size_t const  numElements)
inline

Constructor that initializes a shared vector to hold for numElements pointers.

Parameters
numElementsThe number of pointers that the vector must be initialized to contain

Member Function Documentation

◆ operator[]()

template<typename T >
T* PointerVector< T >::operator[] ( size_t const  i)
inline

@biref Access the pointer at the \(i\)-th position

Parameters
iThe position of the requested pointer
Returns
Pointer at the \(i\)-th position

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