OpenFPM_pdata  4.1.0
Project that contain the implementation of distributed structures
openfpm::vector_fr< T > Class Template Reference

Implementation of 1-D std::vector like structure. More...

Detailed Description

template<typename T>
class openfpm::vector_fr< T >

Implementation of 1-D std::vector like structure.

this implementation is just a wrapper for the std::vector. It work a little different from vector. In general for a normal vector of objects A vector if you resize to zero, the destructor of the object A is called.This vector differ in this behaviour. the destructor is not called. This give the possibility to have a set of fully retained objects. This class is just a simple wrapper for the normal openfpm::vector where size and resize are redefined to change the behaviour. A destructive resize is callable with resize_base(), and the internal size of the base vactor can be queried with size_base()

Parameters
Tbase type

Definition at line 920 of file map_vector.hpp.

#include <map_vector.hpp>

+ Inheritance diagram for openfpm::vector_fr< T >:

Public Member Functions

size_t size ()
 return the size of the vector More...
 
size_t size_base ()
 return the base size of the vector More...
 
void resize (size_t sz)
 resize the vector retaining the objects More...
 
void clear ()
 Eliminate all elements. More...
 
void add ()
 Add another element. More...
 
void resize_base (size_t sz)
 resize the base vector (this kill the objects) More...
 
T & get (size_t id)
 Get an element of the vector. More...
 
T & operator[] (size_t id)
 Get an element of the vector. More...
 
T & last ()
 Get an element of the vector. More...
 
void swap (openfpm::vector_fr< T > &v)
 

Private Types

typedef vector< T, HeapMemory, memory_traits_lin, grow_policy_double, STD_VECTOR > base_type
 

Private Attributes

size_t v_size = 0
 size of the vector
 

Member Function Documentation

◆ add()

template<typename T>
void openfpm::vector_fr< T >::add ( )
inline

Add another element.

Definition at line 981 of file map_vector.hpp.

◆ clear()

template<typename T>
void openfpm::vector_fr< T >::clear ( )
inline

Eliminate all elements.

Definition at line 972 of file map_vector.hpp.

◆ get()

template<typename T>
T& openfpm::vector_fr< T >::get ( size_t  id)
inline

Get an element of the vector.

Parameters
idelement to get
Returns
the element reference

Definition at line 1004 of file map_vector.hpp.

◆ last()

template<typename T>
T& openfpm::vector_fr< T >::last ( )
inline

Get an element of the vector.

Parameters
idelement to get
Returns
the element reference

Definition at line 1028 of file map_vector.hpp.

◆ operator[]()

template<typename T>
T& openfpm::vector_fr< T >::operator[] ( size_t  id)
inline

Get an element of the vector.

Parameters
idelement to get
Returns
the element reference

Definition at line 1016 of file map_vector.hpp.

◆ resize()

template<typename T>
void openfpm::vector_fr< T >::resize ( size_t  sz)
inline

resize the vector retaining the objects

Parameters
newsize of the vector

Definition at line 955 of file map_vector.hpp.

◆ resize_base()

template<typename T>
void openfpm::vector_fr< T >::resize_base ( size_t  sz)
inline

resize the base vector (this kill the objects)

Parameters
newsize of the vector

Definition at line 991 of file map_vector.hpp.

◆ size()

template<typename T>
size_t openfpm::vector_fr< T >::size ( )
inline

return the size of the vector

Returns
the size

Definition at line 935 of file map_vector.hpp.

◆ size_base()

template<typename T>
size_t openfpm::vector_fr< T >::size_base ( )
inline

return the base size of the vector

Returns
the size

Definition at line 945 of file map_vector.hpp.

◆ swap()

template<typename T>
void openfpm::vector_fr< T >::swap ( openfpm::vector_fr< T > &  v)
inline

swap the content of the vector

Parameters
vvector to be swapped with

Definition at line 1038 of file map_vector.hpp.


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