OpenFPM_pdata  4.1.0
Project that contain the implementation of distributed structures
 
Loading...
Searching...
No Matches
vector_fr< T > Class Template Reference

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

Detailed Description

template<typename T>
class 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 930 of file map_vector_std.hpp.

#include <map_vector_std.hpp>

+ Inheritance diagram for vector_fr< T >:

Public Member Functions

size_t size ()
 return the size of the vector
 
size_t size_base ()
 return the base size of the vector
 
void resize (size_t sz)
 resize the vector retaining the objects
 
void clear ()
 Eliminate all elements.
 
void add ()
 Add another element.
 
void resize_base (size_t sz)
 resize the base vector (this kill the objects)
 
T & get (size_t id)
 Get an element of the vector.
 
T & operator[] (size_t id)
 Get an element of the vector.
 
T & last ()
 Get an element of the vector.
 
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 Typedef Documentation

◆ base_type

template<typename T >
typedef vector<T,HeapMemory,memory_traits_lin,grow_policy_double,STD_VECTOR> vector_fr< T >::base_type
private

Definition at line 933 of file map_vector_std.hpp.

Member Function Documentation

◆ add()

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

Add another element.

Definition at line 991 of file map_vector_std.hpp.

◆ clear()

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

Eliminate all elements.

Definition at line 982 of file map_vector_std.hpp.

◆ get()

template<typename T >
T & 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 1014 of file map_vector_std.hpp.

◆ last()

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

Get an element of the vector.

Parameters
idelement to get
Returns
the element reference

Definition at line 1038 of file map_vector_std.hpp.

◆ operator[]()

template<typename T >
T & 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 1026 of file map_vector_std.hpp.

◆ resize()

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

resize the vector retaining the objects

Parameters
newsize of the vector

Definition at line 965 of file map_vector_std.hpp.

◆ resize_base()

template<typename T >
void 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 1001 of file map_vector_std.hpp.

◆ size()

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

return the size of the vector

Returns
the size

Definition at line 945 of file map_vector_std.hpp.

◆ size_base()

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

return the base size of the vector

Returns
the size

Definition at line 955 of file map_vector_std.hpp.

◆ swap()

template<typename T >
void 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 1048 of file map_vector_std.hpp.

Field Documentation

◆ v_size

template<typename T >
size_t vector_fr< T >::v_size = 0
private

size of the vector

Definition at line 936 of file map_vector_std.hpp.


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