OpenFPM_pdata  4.1.0
Project that contain the implementation of distributed structures
openfpm::vector< T, HeapMemory, memory_traits_lin, grow_p, STD_VECTOR > Class Template Reference

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

Detailed Description

template<typename T, typename grow_p>
class openfpm::vector< T, HeapMemory, memory_traits_lin, grow_p, STD_VECTOR >

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

this implementation is just a wrapper for the std::vector in the case of data where the members cannot be parsed see openFPM_data wiki for more information

Create add and access the elements

Parameters
Tbase type

Definition at line 93 of file map_vector.hpp.

#include <map_vector.hpp>

Data Structures

struct  layout_base__
 
struct  pack_cond
 Structures that do a nested packing, depending on the existence of 'pack' function inside of the object. More...
 
struct  pack_cond< true, T1, Memory1, prp... >
 Structures that do a nested packing, depending on the existence of 'pack' function inside of the object. More...
 
struct  packMem_cond
 Structures that calculate memory for an object, depending on the existence of 'packMem' function inside the object. More...
 
struct  packMem_cond< true, T1, prp... >
 Structures that calculate memory for an object, depending on the existence of 'packMem' function inside the object. More...
 
struct  packRequest_cond
 Structures that do a pack request, depending on the existence of 'packRequest' function inside of the object. More...
 
struct  packRequest_cond< true, T1, prp... >
 Structures that do a pack request, depending on the existence of 'packRequest' function inside of the object. More...
 
struct  unpack_cond
 Structures that do a nested unpacking, depending on the existence of 'pack' function inside the object. More...
 
struct  unpack_cond< true, T1, Memory1, prp... >
 Structures that do a nested unpacking, depending on the existence of 'pack' function inside the object. More...
 

Public Types

typedef int yes_i_am_vector
 it define that it is a vector
 
typedef memory_traits_lin< T > layout_base_
 
typedef vector_key_iterator iterator_key
 iterator for the vector
 
typedef T value_type
 Type of the value the vector is storing.
 
typedef void base_to_copy
 
typedef grow_policy_double grow_policy
 growing policy of this vector
 

Public Member Functions

template<int ... prp>
void pack (ExtPreAlloc< HeapMemory > &mem, Pack_stat &sts) const
 pack a vector More...
 
template<int ... prp>
void packRequest (size_t &req) const
 Insert an allocation request into the vector. More...
 
template<unsigned int ... prp>
void unpack (ExtPreAlloc< HeapMemory > &mem, Unpack_stat &ps)
 unpack a vector More...
 
bool save (const std::string &file) const
 Save this object into file. More...
 
bool load (const std::string &file)
 Load this object from file. More...
 
size_t size () const
 return the size of the vector
 
void resize (size_t slot)
 
void clear ()
 Remove all the element from the vector. More...
 
void shrink_to_fit ()
 Fit the memory to the size of the vector. More...
 
void add (const T &v)
 It insert a new object on the vector, eventually it reallocate the grid. More...
 
void add (T &&v)
 It insert a new object on the vector, eventually it reallocate the grid. More...
 
void add ()
 Add an empty object (it call the default constructor () ) at the end of the vector. More...
 
template<typename Mem , template< typename > class lb, typename gp >
void add (const openfpm::vector< T, Mem, lb, gp > &eles)
 add elements to the vector More...
 
template<typename S >
void add (const S &v)
 It insert a new object on the vector, eventually it reallocate the object. More...
 
template<typename S >
void add (const S &&v)
 It insert a new object on the vector, eventually it reallocate the grid. More...
 
template<typename S , typename M , typename gp , unsigned int impl, template< typename > class layout_base, unsigned int ... args>
void add_prp (const vector< S, M, layout_base, gp, impl > &v)
 It add the element of a source vector to this vector. More...
 
template<typename S , typename M , typename gp , unsigned int impl, template< typename > class layout_base, unsigned int ... args>
void add_prp_device (const vector< S, M, layout_base, gp, impl > &v)
 It add the element of a source vector to this vector. More...
 
template<typename S , typename M , typename gp , unsigned int impl, template< typename > class layout_base, unsigned int ... args>
void add_prp (const T &v)
 It add the element it is equivalent to add. More...
 
void erase (typename std::vector< T >::iterator start, typename std::vector< T >::iterator end)
 Erase the elements from start to end. More...
 
void remove (size_t key)
 Remove one entry from the vector. More...
 
void remove (openfpm::vector< size_t > &keys, size_t start=0)
 Remove several entries from the vector. More...
 
auto begin () -> decltype(base.begin())
 Return an std compatible iterator to the first element. More...
 
auto end () -> decltype(base.begin())
 Return an std compatible iterator to the last element. More...
 
auto begin () const -> const decltype(base.begin())
 Return an std compatible iterator to the first element. More...
 
auto end () const -> const decltype(base.begin())
 Return an std compatible iterator to the last element. More...
 
T & last ()
 Get the last element. More...
 
const T & last () const
 Get the last element. More...
 
openfpm::vector< T > duplicate () const
 Duplicate the vector. More...
 
void swap (std::vector< T > &&v)
 swap the memory between the two vector More...
 
void unique ()
 It eliminate double entries. More...
 
void sort ()
 It sort the vector. More...
 
template<unsigned int p>
T & get (size_t id)
 Get an element of the vector. More...
 
template<unsigned int p>
const T & get (size_t id) const
 Get an element of the vector. More...
 
T & get (size_t id)
 Get an element of the vector. More...
 
const T & get (size_t id) const
 Get an element of the vector. More...
 
void fill (unsigned char fl)
 it fill all the memory of fl patterns More...
 
void reserve (size_t ns)
 reserve a memory space in advance to avoid reallocation More...
 
 vector () noexcept
 Constructor, vector of size 0.
 
 vector (size_t sz) noexcept
 Constructor, vector of size sz.
 
 vector (const vector< T, HeapMemory, memory_traits_lin, grow_policy_double, STD_VECTOR > &v) noexcept
 Constructor from another vector.
 
 vector (const std::initializer_list< T > &v)
 Initializer from constructor. More...
 
 vector (vector< T, HeapMemory, memory_traits_lin, grow_policy_double, STD_VECTOR > &&v) noexcept
 Constructor from another vector.
 
 ~vector () noexcept
 destructor
 
void swap (openfpm::vector< T, HeapMemory, memory_traits_lin, grow_policy_double, STD_VECTOR > &v)
 
void swap (openfpm::vector< T, HeapMemory, memory_traits_lin, grow_policy_double, STD_VECTOR > &&v)
 
vector< T, HeapMemory, memory_traits_lin, grow_policy_double, STD_VECTOR > & operator= (const vector< T, HeapMemory, memory_traits_lin, grow_policy_double, STD_VECTOR > &v)
 Operator= copy the vector into another. More...
 
template<typename Mem , typename gp >
vector< T, HeapMemory, memory_traits_lin, grow_policy_double, STD_VECTOR > & operator= (const vector< T, Mem, memory_traits_lin, gp, STD_VECTOR > &v)
 Operator= copy the vector into another. More...
 
vector< T, HeapMemory, memory_traits_lin, grow_policy_double, STD_VECTOR > & operator= (vector< T, HeapMemory, memory_traits_lin, grow_policy_double, STD_VECTOR > &&v)
 Operator= copy the vector into another. More...
 
template<typename Mem , typename gp >
vector< T, HeapMemory, memory_traits_lin, grow_policy_double, STD_VECTOR > & operator= (vector< T, Mem, memory_traits_lin, gp, STD_VECTOR > &&v)
 Operator= copy the vector into another. More...
 
bool operator!= (const vector< T, HeapMemory, memory_traits_lin, grow_policy_double, STD_VECTOR > &v) const
 Check that two vectors are equal. More...
 
bool operator== (const vector< T, HeapMemory, memory_traits_lin, grow_policy_double, STD_VECTOR > &v) const
 Check that two vectors are not equal. More...
 
vector_key_iterator getIterator () const
 Get an iterator over all the elements of the vector. More...
 
vector_key_iterator getIteratorTo (size_t k) const
 Get iterator until a specified element. More...
 
template<int ... prp>
size_t packMem (size_t n, size_t e) const
 Calculate the memory size required to allocate n elements. More...
 
void * getPointer ()
 Return the pointer to the chunk of memory. More...
 
template<unsigned int ... prp>
void hostToDevice ()
 Do nothing. More...
 
template<unsigned int ... prp>
void deviceToHost ()
 Do nothing. More...
 
template<unsigned int ... prp>
void deviceToHost (size_t start, size_t stop)
 Do nothing. More...
 
template<unsigned int ... prp>
void hostToDevice (size_t start, size_t stop)
 Do nothing. More...
 
const void * getPointer () const
 Return the pointer to the chunk of memory. More...
 
size_t getLastError ()
 Return the last error. More...
 
void vector_overflow (size_t v1) const
 check that the id does not overflow the buffer More...
 

Static Public Member Functions

static bool pack ()
 Indicate that the vector has a packer function.
 
static bool packRequest ()
 Indicate that the vector has the function packRequest.
 
static bool packMem ()
 Indicate that the vector has the function pack Memory.
 
static size_t calculateMemDummy (size_t n, size_t e)
 Calculate the memory size required to allocate n elements. More...
 
static size_t calculateNMem (size_t n)
 How many allocation are required to create n-elements. More...
 
static bool noPointers ()
 This class has pointer inside. More...
 

Private Types

typedef memory_traits_lin< T >::type layout
 

Private Attributes

std::vector< T > base
 1-D static grid
 
size_t err_code = 0
 Error code.
 

Constructor & Destructor Documentation

◆ vector()

template<typename T , typename grow_p >
openfpm::vector< T, HeapMemory, memory_traits_lin, grow_p, STD_VECTOR >::vector ( const std::initializer_list< T > &  v)
inline

Initializer from constructor.

Parameters
vInitializer list

Definition at line 635 of file map_vector.hpp.

Member Function Documentation

◆ add() [1/6]

template<typename T , typename grow_p >
void openfpm::vector< T, HeapMemory, memory_traits_lin, grow_p, STD_VECTOR >::add ( const T &  v)
inline

It insert a new object on the vector, eventually it reallocate the grid.

Parameters
velement to add
Warning
It is not thread safe should not be used in multi-thread environment reallocation, work only on cpu

vector_isel<T>::value

Definition at line 174 of file map_vector.hpp.

◆ add() [2/6]

template<typename T , typename grow_p >
void openfpm::vector< T, HeapMemory, memory_traits_lin, grow_p, STD_VECTOR >::add ( T &&  v)
inline

It insert a new object on the vector, eventually it reallocate the grid.

Parameters
velement to add
Warning
It is not thread safe should not be used in multi-thread environment reallocation, work only on cpu

vector_isel<T>::value

Definition at line 194 of file map_vector.hpp.

◆ add() [3/6]

template<typename T , typename grow_p >
void openfpm::vector< T, HeapMemory, memory_traits_lin, grow_p, STD_VECTOR >::add ( )
inline

Add an empty object (it call the default constructor () ) at the end of the vector.

Definition at line 208 of file map_vector.hpp.

◆ add() [4/6]

template<typename T , typename grow_p >
template<typename Mem , template< typename > class lb, typename gp >
void openfpm::vector< T, HeapMemory, memory_traits_lin, grow_p, STD_VECTOR >::add ( const openfpm::vector< T, Mem, lb, gp > &  eles)
inline

add elements to the vector

Parameters
eleselements to add

Definition at line 218 of file map_vector.hpp.

◆ add() [5/6]

template<typename T , typename grow_p >
template<typename S >
void openfpm::vector< T, HeapMemory, memory_traits_lin, grow_p, STD_VECTOR >::add ( const S &  v)
inline

It insert a new object on the vector, eventually it reallocate the object.

Parameters
velement to add
Warning
It is not thread safe should not be used in multi-thread environment reallocation, work only on cpu

vector_isel<T>::value

Definition at line 242 of file map_vector.hpp.

◆ add() [6/6]

template<typename T , typename grow_p >
template<typename S >
void openfpm::vector< T, HeapMemory, memory_traits_lin, grow_p, STD_VECTOR >::add ( const S &&  v)
inline

It insert a new object on the vector, eventually it reallocate the grid.

Parameters
velement to add
Warning
It is not thread safe should not be used in multi-thread environment reallocation, work only on cpu

vector_isel<T>::value

Definition at line 256 of file map_vector.hpp.

◆ add_prp() [1/2]

template<typename T , typename grow_p >
template<typename S , typename M , typename gp , unsigned int impl, template< typename > class layout_base, unsigned int ... args>
void openfpm::vector< T, HeapMemory, memory_traits_lin, grow_p, STD_VECTOR >::add_prp ( const vector< S, M, layout_base, gp, impl > &  v)
inline

It add the element of a source vector to this vector.

The number of properties in the source vector must be smaller than the destination all the properties of S must be mapped so if S has 3 properties 3 numbers for args are required

Template Parameters
SBase object of the source vector
Mmemory type of the source vector
gpGrow policy of the source vector
argsone or more number that define which property to set-up
Parameters
vsource vector

Definition at line 287 of file map_vector.hpp.

◆ add_prp() [2/2]

template<typename T , typename grow_p >
template<typename S , typename M , typename gp , unsigned int impl, template< typename > class layout_base, unsigned int ... args>
void openfpm::vector< T, HeapMemory, memory_traits_lin, grow_p, STD_VECTOR >::add_prp ( const T &  v)
inline

It add the element it is equivalent to add.

exist to respect a general interface template parameters are unused the explanation refer to the interface specification, but is unused in this case

Template Parameters
SBase object of the source vector
Mmemory type of the source vector
gpGrow policy of the source vector
argsone or more number that define which property to set-up
Parameters
vsource vector

Definition at line 336 of file map_vector.hpp.

◆ add_prp_device()

template<typename T , typename grow_p >
template<typename S , typename M , typename gp , unsigned int impl, template< typename > class layout_base, unsigned int ... args>
void openfpm::vector< T, HeapMemory, memory_traits_lin, grow_p, STD_VECTOR >::add_prp_device ( const vector< S, M, layout_base, gp, impl > &  v)
inline

It add the element of a source vector to this vector.

The number of properties in the source vector must be smaller than the destination all the properties of S must be mapped so if S has 3 properties 3 numbers for args are required

Template Parameters
SBase object of the source vector
Mmemory type of the source vector
gpGrow policy of the source vector
argsone or more number that define which property to set-up
Parameters
vsource vector

Definition at line 312 of file map_vector.hpp.

◆ begin() [1/2]

template<typename T , typename grow_p >
auto openfpm::vector< T, HeapMemory, memory_traits_lin, grow_p, STD_VECTOR >::begin ( ) -> decltype(base.begin())
inline

Return an std compatible iterator to the first element.

Returns
an iterator to the first element

Definition at line 412 of file map_vector.hpp.

◆ begin() [2/2]

template<typename T , typename grow_p >
auto openfpm::vector< T, HeapMemory, memory_traits_lin, grow_p, STD_VECTOR >::begin ( ) const -> const decltype(base.begin())
inline

Return an std compatible iterator to the first element.

Returns
an iterator to the first element

Definition at line 432 of file map_vector.hpp.

◆ calculateMemDummy()

template<typename T , typename grow_p >
static size_t openfpm::vector< T, HeapMemory, memory_traits_lin, grow_p, STD_VECTOR >::calculateMemDummy ( size_t  n,
size_t  e 
)
inlinestatic

Calculate the memory size required to allocate n elements.

Calculate the total size required to store n-elements in a vector

Parameters
nnumber of elements
eunused
Returns
the size of the allocation number e

Definition at line 805 of file map_vector.hpp.

◆ calculateNMem()

template<typename T , typename grow_p >
static size_t openfpm::vector< T, HeapMemory, memory_traits_lin, grow_p, STD_VECTOR >::calculateNMem ( size_t  n)
inlinestatic

How many allocation are required to create n-elements.

Parameters
nnumber of elements
Returns
the number of allocations

Definition at line 817 of file map_vector.hpp.

◆ clear()

template<typename T , typename grow_p >
void openfpm::vector< T, HeapMemory, memory_traits_lin, grow_p, STD_VECTOR >::clear ( )
inline

Remove all the element from the vector.

Definition at line 152 of file map_vector.hpp.

◆ deviceToHost() [1/2]

template<typename T , typename grow_p >
template<unsigned int ... prp>
void openfpm::vector< T, HeapMemory, memory_traits_lin, grow_p, STD_VECTOR >::deviceToHost ( )
inline

Do nothing.

Definition at line 842 of file map_vector.hpp.

◆ deviceToHost() [2/2]

template<typename T , typename grow_p >
template<unsigned int ... prp>
void openfpm::vector< T, HeapMemory, memory_traits_lin, grow_p, STD_VECTOR >::deviceToHost ( size_t  start,
size_t  stop 
)
inline

Do nothing.

Definition at line 849 of file map_vector.hpp.

◆ duplicate()

template<typename T , typename grow_p >
openfpm::vector<T> openfpm::vector< T, HeapMemory, memory_traits_lin, grow_p, STD_VECTOR >::duplicate ( ) const
inline

Duplicate the vector.

Returns
the duplicated vector

Definition at line 480 of file map_vector.hpp.

◆ end() [1/2]

template<typename T , typename grow_p >
auto openfpm::vector< T, HeapMemory, memory_traits_lin, grow_p, STD_VECTOR >::end ( ) -> decltype(base.begin())
inline

Return an std compatible iterator to the last element.

Returns
an iterator to the last element

Definition at line 422 of file map_vector.hpp.

◆ end() [2/2]

template<typename T , typename grow_p >
auto openfpm::vector< T, HeapMemory, memory_traits_lin, grow_p, STD_VECTOR >::end ( ) const -> const decltype(base.begin())
inline

Return an std compatible iterator to the last element.

Returns
an iterator to the last element

Definition at line 442 of file map_vector.hpp.

◆ erase()

template<typename T , typename grow_p >
void openfpm::vector< T, HeapMemory, memory_traits_lin, grow_p, STD_VECTOR >::erase ( typename std::vector< T >::iterator  start,
typename std::vector< T >::iterator  end 
)
inline

Erase the elements from start to end.

Parameters
startelement
endelement

Definition at line 347 of file map_vector.hpp.

◆ fill()

template<typename T , typename grow_p >
void openfpm::vector< T, HeapMemory, memory_traits_lin, grow_p, STD_VECTOR >::fill ( unsigned char  fl)
inline

it fill all the memory of fl patterns

WARNING does not assign a value to each element but it fill the memory Useful to fast set the memory to zero

Parameters
flbyte to fill

Definition at line 596 of file map_vector.hpp.

◆ get() [1/4]

template<typename T , typename grow_p >
template<unsigned int p>
T& openfpm::vector< T, HeapMemory, memory_traits_lin, grow_p, STD_VECTOR >::get ( size_t  id)
inline

Get an element of the vector.

Template Parameters
pmust be 0
Parameters
idelement to get
Returns
the reference to the element

Definition at line 525 of file map_vector.hpp.

◆ get() [2/4]

template<typename T , typename grow_p >
template<unsigned int p>
const T& openfpm::vector< T, HeapMemory, memory_traits_lin, grow_p, STD_VECTOR >::get ( size_t  id) const
inline

Get an element of the vector.

Template Parameters
pmust be 0
Parameters
idelement to get
Returns
the reference to the element

Definition at line 546 of file map_vector.hpp.

◆ get() [3/4]

template<typename T , typename grow_p >
T& openfpm::vector< T, HeapMemory, memory_traits_lin, grow_p, STD_VECTOR >::get ( size_t  id)
inline

Get an element of the vector.

Parameters
idelement to get
Returns
the element reference

Definition at line 565 of file map_vector.hpp.

◆ get() [4/4]

template<typename T , typename grow_p >
const T& openfpm::vector< T, HeapMemory, memory_traits_lin, grow_p, STD_VECTOR >::get ( size_t  id) const
inline

Get an element of the vector.

Parameters
idelement to get
Returns
the element value

Definition at line 580 of file map_vector.hpp.

◆ getIterator()

template<typename T , typename grow_p >
vector_key_iterator openfpm::vector< T, HeapMemory, memory_traits_lin, grow_p, STD_VECTOR >::getIterator ( ) const
inline

Get an iterator over all the elements of the vector.

Returns
an iterator

Definition at line 757 of file map_vector.hpp.

◆ getIteratorTo()

template<typename T , typename grow_p >
vector_key_iterator openfpm::vector< T, HeapMemory, memory_traits_lin, grow_p, STD_VECTOR >::getIteratorTo ( size_t  k) const
inline

Get iterator until a specified element.

Parameters
kkey
Returns
an iterator

Definition at line 769 of file map_vector.hpp.

◆ getLastError()

template<typename T , typename grow_p >
size_t openfpm::vector< T, HeapMemory, memory_traits_lin, grow_p, STD_VECTOR >::getLastError ( )
inline

Return the last error.

Returns
erro code

Definition at line 884 of file map_vector.hpp.

◆ getPointer() [1/2]

template<typename T , typename grow_p >
void* openfpm::vector< T, HeapMemory, memory_traits_lin, grow_p, STD_VECTOR >::getPointer ( )
inline

Return the pointer to the chunk of memory.

Returns
the pointer to the chunk of memory

Definition at line 828 of file map_vector.hpp.

◆ getPointer() [2/2]

template<typename T , typename grow_p >
const void* openfpm::vector< T, HeapMemory, memory_traits_lin, grow_p, STD_VECTOR >::getPointer ( ) const
inline

Return the pointer to the chunk of memory.

Returns
the pointer to the chunk of memory

Definition at line 864 of file map_vector.hpp.

◆ hostToDevice() [1/2]

template<typename T , typename grow_p >
template<unsigned int ... prp>
void openfpm::vector< T, HeapMemory, memory_traits_lin, grow_p, STD_VECTOR >::hostToDevice ( )
inline

Do nothing.

Definition at line 836 of file map_vector.hpp.

◆ hostToDevice() [2/2]

template<typename T , typename grow_p >
template<unsigned int ... prp>
void openfpm::vector< T, HeapMemory, memory_traits_lin, grow_p, STD_VECTOR >::hostToDevice ( size_t  start,
size_t  stop 
)
inline

Do nothing.

Definition at line 856 of file map_vector.hpp.

◆ last() [1/2]

template<typename T , typename grow_p >
T& openfpm::vector< T, HeapMemory, memory_traits_lin, grow_p, STD_VECTOR >::last ( )
inline

Get the last element.

Returns
the last element as reference

Definition at line 452 of file map_vector.hpp.

◆ last() [2/2]

template<typename T , typename grow_p >
const T& openfpm::vector< T, HeapMemory, memory_traits_lin, grow_p, STD_VECTOR >::last ( ) const
inline

Get the last element.

Returns
the last element as reference

Definition at line 466 of file map_vector.hpp.

◆ load()

template<typename T , typename grow_p >
bool openfpm::vector< T, HeapMemory, memory_traits_lin, grow_p, STD_VECTOR >::load ( const std::string &  file)
inline

Load this object from file.

Parameters
filefilename
Returns
true if succed

Definition at line 248 of file map_vector.hpp.

◆ noPointers()

template<typename T , typename grow_p >
static bool openfpm::vector< T, HeapMemory, memory_traits_lin, grow_p, STD_VECTOR >::noPointers ( )
inlinestatic

This class has pointer inside.

Returns
false

Definition at line 874 of file map_vector.hpp.

◆ operator!=()

template<typename T , typename grow_p >
bool openfpm::vector< T, HeapMemory, memory_traits_lin, grow_p, STD_VECTOR >::operator!= ( const vector< T, HeapMemory, memory_traits_lin, grow_policy_double, STD_VECTOR > &  v) const
inline

Check that two vectors are equal.

Parameters
vvector to compare
Returns
true if they differs

Definition at line 735 of file map_vector.hpp.

◆ operator=() [1/4]

template<typename T , typename grow_p >
vector<T,HeapMemory,memory_traits_lin,grow_policy_double,STD_VECTOR>& openfpm::vector< T, HeapMemory, memory_traits_lin, grow_p, STD_VECTOR >::operator= ( const vector< T, HeapMemory, memory_traits_lin, grow_policy_double, STD_VECTOR > &  v)
inline

Operator= copy the vector into another.

Parameters
vvector to copy
Returns
itself

Definition at line 679 of file map_vector.hpp.

◆ operator=() [2/4]

template<typename T , typename grow_p >
template<typename Mem , typename gp >
vector<T,HeapMemory,memory_traits_lin,grow_policy_double,STD_VECTOR>& openfpm::vector< T, HeapMemory, memory_traits_lin, grow_p, STD_VECTOR >::operator= ( const vector< T, Mem, memory_traits_lin, gp, STD_VECTOR > &  v)
inline

Operator= copy the vector into another.

Returns
itself

Definition at line 691 of file map_vector.hpp.

◆ operator=() [3/4]

template<typename T , typename grow_p >
vector<T,HeapMemory,memory_traits_lin,grow_policy_double,STD_VECTOR>& openfpm::vector< T, HeapMemory, memory_traits_lin, grow_p, STD_VECTOR >::operator= ( vector< T, HeapMemory, memory_traits_lin, grow_policy_double, STD_VECTOR > &&  v)
inline

Operator= copy the vector into another.

Parameters
vvector to copy
Returns
itself

Definition at line 707 of file map_vector.hpp.

◆ operator=() [4/4]

template<typename T , typename grow_p >
template<typename Mem , typename gp >
vector<T,HeapMemory,memory_traits_lin,grow_policy_double,STD_VECTOR>& openfpm::vector< T, HeapMemory, memory_traits_lin, grow_p, STD_VECTOR >::operator= ( vector< T, Mem, memory_traits_lin, gp, STD_VECTOR > &&  v)
inline

Operator= copy the vector into another.

Parameters
vvector to copy
Returns
itself

Definition at line 721 of file map_vector.hpp.

◆ operator==()

template<typename T , typename grow_p >
bool openfpm::vector< T, HeapMemory, memory_traits_lin, grow_p, STD_VECTOR >::operator== ( const vector< T, HeapMemory, memory_traits_lin, grow_policy_double, STD_VECTOR > &  v) const
inline

Check that two vectors are not equal.

Parameters
vvector to compare
Returns
true if the vector match

Definition at line 747 of file map_vector.hpp.

◆ pack()

template<typename T , typename grow_p >
template<int ... prp>
void openfpm::vector< T, HeapMemory, memory_traits_lin, grow_p, STD_VECTOR >::pack ( ExtPreAlloc< HeapMemory > &  mem,
Pack_stat sts 
) const
inline

pack a vector

Parameters
mempreallocated memory where to pack the vector
stspack-stat info

Definition at line 171 of file map_vector.hpp.

◆ packMem()

template<typename T , typename grow_p >
template<int ... prp>
size_t openfpm::vector< T, HeapMemory, memory_traits_lin, grow_p, STD_VECTOR >::packMem ( size_t  n,
size_t  e 
) const
inline

Calculate the memory size required to allocate n elements.

Calculate the total size required to store n-elements in a vector

Parameters
nnumber of elements
eunused
Returns
the size of the allocation number e

Definition at line 784 of file map_vector.hpp.

◆ packRequest()

template<typename T , typename grow_p >
template<int ... prp>
void openfpm::vector< T, HeapMemory, memory_traits_lin, grow_p, STD_VECTOR >::packRequest ( size_t &  req) const
inline

Insert an allocation request into the vector.

Template Parameters
prpproperties to pack
Parameters
reqcounter with the byte required to pack the vector

Definition at line 186 of file map_vector.hpp.

◆ remove() [1/2]

template<typename T , typename grow_p >
void openfpm::vector< T, HeapMemory, memory_traits_lin, grow_p, STD_VECTOR >::remove ( size_t  key)
inline

Remove one entry from the vector.

Parameters
keyelement to remove

Definition at line 357 of file map_vector.hpp.

◆ remove() [2/2]

template<typename T , typename grow_p >
void openfpm::vector< T, HeapMemory, memory_traits_lin, grow_p, STD_VECTOR >::remove ( openfpm::vector< size_t > &  keys,
size_t  start = 0 
)
inline

Remove several entries from the vector.

Warning
the keys in the vector MUST be sorted
Parameters
keysobjects id to remove
startkey starting point

Definition at line 373 of file map_vector.hpp.

◆ reserve()

template<typename T , typename grow_p >
void openfpm::vector< T, HeapMemory, memory_traits_lin, grow_p, STD_VECTOR >::reserve ( size_t  ns)
inline

reserve a memory space in advance to avoid reallocation

Parameters
nsnumber of element the memory has to store

Definition at line 606 of file map_vector.hpp.

◆ resize()

template<typename T , typename grow_p >
void openfpm::vector< T, HeapMemory, memory_traits_lin, grow_p, STD_VECTOR >::resize ( size_t  slot)
inline

\ brief Resize the vector to contain n elements

Parameters
slotnumber of elements

Definition at line 144 of file map_vector.hpp.

◆ save()

template<typename T , typename grow_p >
bool openfpm::vector< T, HeapMemory, memory_traits_lin, grow_p, STD_VECTOR >::save ( const std::string &  file) const
inline

Save this object into file.

Parameters
filefilename
Returns
true if succed

Definition at line 216 of file map_vector.hpp.

◆ shrink_to_fit()

template<typename T , typename grow_p >
void openfpm::vector< T, HeapMemory, memory_traits_lin, grow_p, STD_VECTOR >::shrink_to_fit ( )
inline

Fit the memory to the size of the vector.

Definition at line 160 of file map_vector.hpp.

◆ sort()

template<typename T , typename grow_p >
void openfpm::vector< T, HeapMemory, memory_traits_lin, grow_p, STD_VECTOR >::sort ( )
inline

It sort the vector.

Note
The base object must have an operator< defined

Definition at line 511 of file map_vector.hpp.

◆ swap() [1/3]

template<typename T , typename grow_p >
void openfpm::vector< T, HeapMemory, memory_traits_lin, grow_p, STD_VECTOR >::swap ( std::vector< T > &&  v)
inline

swap the memory between the two vector

Parameters
vvector to swap

Definition at line 490 of file map_vector.hpp.

◆ swap() [2/3]

template<typename T , typename grow_p >
void openfpm::vector< T, HeapMemory, memory_traits_lin, grow_p, STD_VECTOR >::swap ( openfpm::vector< T, HeapMemory, memory_traits_lin, grow_policy_double, STD_VECTOR > &  v)
inline

swap the content of the vector

Parameters
vvector to be swapped with

Definition at line 657 of file map_vector.hpp.

◆ swap() [3/3]

template<typename T , typename grow_p >
void openfpm::vector< T, HeapMemory, memory_traits_lin, grow_p, STD_VECTOR >::swap ( openfpm::vector< T, HeapMemory, memory_traits_lin, grow_policy_double, STD_VECTOR > &&  v)
inline

swap the content of the vector

Parameters
vvector to be swapped with

Definition at line 667 of file map_vector.hpp.

◆ unique()

template<typename T , typename grow_p >
void openfpm::vector< T, HeapMemory, memory_traits_lin, grow_p, STD_VECTOR >::unique ( )
inline

It eliminate double entries.

Note
The base object must have an operator== defined

Definition at line 500 of file map_vector.hpp.

◆ unpack()

template<typename T , typename grow_p >
template<unsigned int ... prp>
void openfpm::vector< T, HeapMemory, memory_traits_lin, grow_p, STD_VECTOR >::unpack ( ExtPreAlloc< HeapMemory > &  mem,
Unpack_stat ps 
)
inline

unpack a vector

Warning
the properties should match the packed properties,
Parameters
mempreallocated memory from where to unpack the vector
psunpack info

Definition at line 202 of file map_vector.hpp.

◆ vector_overflow()

template<typename T , typename grow_p >
void openfpm::vector< T, HeapMemory, memory_traits_lin, grow_p, STD_VECTOR >::vector_overflow ( size_t  v1) const
inline

check that the id does not overflow the buffer

Parameters
v1id to check

Definition at line 894 of file map_vector.hpp.


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