OpenFPM_pdata  4.1.0
Project that contain the implementation of distributed structures
 
Loading...
Searching...
No Matches
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 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_std.hpp.

#include <map_vector_std.hpp>

Data Structures

struct  layout_base__
 

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

size_t size () const
 return the size of the vector
 
void resize (size_t slot)
 
void clear ()
 Remove all the element from the vector.
 
void shrink_to_fit ()
 Fit the memory to the size of the vector.
 
void add (const T &v)
 It insert a new object on the vector, eventually it reallocate the grid.
 
void add (T &&v)
 It insert a new object on the vector, eventually it reallocate the grid.
 
void add ()
 Add an empty object (it call the default constructor () ) at the end of the vector.
 
template<typename Mem , template< typename > class lb, typename gp >
void add (const openfpm::vector< T, Mem, lb, gp > &eles)
 add elements to the vector
 
template<typename S >
void add (const S &v)
 It insert a new object on the vector, eventually it reallocate the object.
 
template<typename S >
void add (const S &&v)
 It insert a new object on the vector, eventually it reallocate the grid.
 
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.
 
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.
 
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.
 
void erase (typename std::vector< T >::iterator start, typename std::vector< T >::iterator end)
 Erase the elements from start to end.
 
void remove (size_t key)
 Remove one entry from the vector.
 
void remove (openfpm::vector< size_t > &keys, size_t start=0)
 Remove several entries from the vector.
 
auto begin () -> decltype(base.begin())
 Return an std compatible iterator to the first element.
 
auto end () -> decltype(base.begin())
 Return an std compatible iterator to the last element.
 
auto begin () const -> const decltype(base.begin())
 Return an std compatible iterator to the first element.
 
auto end () const -> const decltype(base.begin())
 Return an std compatible iterator to the last element.
 
T & last ()
 Get the last element.
 
const T & last () const
 Get the last element.
 
openfpm::vector< T > duplicate () const
 Duplicate the vector.
 
void swap (std::vector< T > &&v)
 swap the memory between the two vector
 
void unique ()
 It eliminate double entries.
 
void sort ()
 It sort the vector.
 
template<unsigned int p>
T & get (size_t id)
 Get an element of the vector.
 
template<unsigned int p>
const T & get (size_t id) const
 Get an element of the vector.
 
T & get (size_t id)
 Get an element of the vector.
 
const T & get (size_t id) const
 Get an element of the vector.
 
void fill (unsigned char fl)
 it fill all the memory of fl patterns
 
void reserve (size_t ns)
 reserve a memory space in advance to avoid reallocation
 
 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.
 
 vector (vector< T, HeapMemory, memory_traits_lin, grow_policy_double, STD_VECTOR > &&v) noexcept
 Constructor from another vector.
 
template<class InputIt >
 vector (InputIt first, InputIt last)
 Constructor from iterators.
 
 ~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.
 
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.
 
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.
 
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.
 
bool operator!= (const vector< T, HeapMemory, memory_traits_lin, grow_policy_double, STD_VECTOR > &v) const
 Check that two vectors are equal.
 
bool operator== (const vector< T, HeapMemory, memory_traits_lin, grow_policy_double, STD_VECTOR > &v) const
 Check that two vectors are not equal.
 
vector_key_iterator getIterator () const
 Get an iterator over all the elements of the vector.
 
vector_key_iterator getIteratorTo (size_t k) const
 Get iterator until a specified element.
 
template<int ... prp>
size_t packMem (size_t n, size_t e) const
 Calculate the memory size required to allocate n elements.
 
void * getPointer ()
 Return the pointer to the chunk of memory.
 
template<unsigned int ... prp>
void hostToDevice ()
 Do nothing.
 
template<unsigned int ... prp>
void deviceToHost ()
 Do nothing.
 
template<unsigned int ... prp>
void deviceToHost (size_t start, size_t stop)
 Do nothing.
 
template<unsigned int ... prp>
void hostToDevice (size_t start, size_t stop)
 Do nothing.
 
const void * getPointer () const
 Return the pointer to the chunk of memory.
 
size_t getLastError ()
 Return the last error.
 
void vector_overflow (size_t v1) const
 check that the id does not overflow the buffer
 

Static Public Member Functions

static size_t calculateMemDummy (size_t n, size_t e)
 Calculate the memory size required to allocate n elements.
 
static size_t calculateNMem (size_t n)
 How many allocation are required to create n-elements.
 
static bool noPointers ()
 This class has pointer inside.
 

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.
 

Member Typedef Documentation

◆ base_to_copy

template<typename T , typename grow_p >
typedef void vector< T, HeapMemory, memory_traits_lin, grow_p, STD_VECTOR >::base_to_copy

Definition at line 118 of file map_vector_std.hpp.

◆ grow_policy

template<typename T , typename grow_p >
typedef grow_policy_double vector< T, HeapMemory, memory_traits_lin, grow_p, STD_VECTOR >::grow_policy

growing policy of this vector

Definition at line 121 of file map_vector_std.hpp.

◆ iterator_key

template<typename T , typename grow_p >
typedef vector_key_iterator vector< T, HeapMemory, memory_traits_lin, grow_p, STD_VECTOR >::iterator_key

iterator for the vector

Definition at line 114 of file map_vector_std.hpp.

◆ layout

template<typename T , typename grow_p >
typedef memory_traits_lin<T>::type vector< T, HeapMemory, memory_traits_lin, grow_p, STD_VECTOR >::layout
private

Definition at line 96 of file map_vector_std.hpp.

◆ layout_base_

template<typename T , typename grow_p >
typedef memory_traits_lin<T> vector< T, HeapMemory, memory_traits_lin, grow_p, STD_VECTOR >::layout_base_

Definition at line 111 of file map_vector_std.hpp.

◆ value_type

template<typename T , typename grow_p >
typedef T vector< T, HeapMemory, memory_traits_lin, grow_p, STD_VECTOR >::value_type

Type of the value the vector is storing.

Definition at line 116 of file map_vector_std.hpp.

◆ yes_i_am_vector

template<typename T , typename grow_p >
typedef int vector< T, HeapMemory, memory_traits_lin, grow_p, STD_VECTOR >::yes_i_am_vector

it define that it is a vector

Definition at line 109 of file map_vector_std.hpp.

Constructor & Destructor Documentation

◆ vector() [1/6]

template<typename T , typename grow_p >
vector< T, HeapMemory, memory_traits_lin, grow_p, STD_VECTOR >::vector ( )
inlinenoexcept

Constructor, vector of size 0.

Definition at line 612 of file map_vector_std.hpp.

◆ vector() [2/6]

template<typename T , typename grow_p >
vector< T, HeapMemory, memory_traits_lin, grow_p, STD_VECTOR >::vector ( size_t  sz)
inlinenoexcept

Constructor, vector of size sz.

Definition at line 618 of file map_vector_std.hpp.

◆ vector() [3/6]

template<typename T , typename grow_p >
vector< T, HeapMemory, memory_traits_lin, grow_p, STD_VECTOR >::vector ( const vector< T, HeapMemory, memory_traits_lin, grow_policy_double, STD_VECTOR > &  v)
inlinenoexcept

Constructor from another vector.

Definition at line 624 of file map_vector_std.hpp.

◆ vector() [4/6]

template<typename T , typename grow_p >
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_std.hpp.

◆ vector() [5/6]

template<typename T , typename grow_p >
vector< T, HeapMemory, memory_traits_lin, grow_p, STD_VECTOR >::vector ( vector< T, HeapMemory, memory_traits_lin, grow_policy_double, STD_VECTOR > &&  v)
inlinenoexcept

Constructor from another vector.

Definition at line 641 of file map_vector_std.hpp.

◆ vector() [6/6]

template<typename T , typename grow_p >
template<class InputIt >
vector< T, HeapMemory, memory_traits_lin, grow_p, STD_VECTOR >::vector ( InputIt  first,
InputIt  last 
)
inline

Constructor from iterators.

Definition at line 649 of file map_vector_std.hpp.

◆ ~vector()

template<typename T , typename grow_p >
vector< T, HeapMemory, memory_traits_lin, grow_p, STD_VECTOR >::~vector ( )
inlinenoexcept

destructor

Definition at line 658 of file map_vector_std.hpp.

Member Function Documentation

◆ add() [1/6]

template<typename T , typename grow_p >
void 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_std.hpp.

◆ add() [2/6]

template<typename T , typename grow_p >
template<typename Mem , template< typename > class lb, typename gp >
void 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_std.hpp.

◆ add() [3/6]

template<typename T , typename grow_p >
template<typename S >
void 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_std.hpp.

◆ add() [4/6]

template<typename T , typename grow_p >
template<typename S >
void 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_std.hpp.

◆ add() [5/6]

template<typename T , typename grow_p >
void 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_std.hpp.

◆ add() [6/6]

template<typename T , typename grow_p >
void 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_std.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 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_std.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 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_std.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 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_std.hpp.

◆ begin() [1/2]

template<typename T , typename grow_p >
auto 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_std.hpp.

◆ begin() [2/2]

template<typename T , typename grow_p >
auto 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_std.hpp.

◆ calculateMemDummy()

template<typename T , typename grow_p >
static size_t 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 815 of file map_vector_std.hpp.

◆ calculateNMem()

template<typename T , typename grow_p >
static size_t 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 827 of file map_vector_std.hpp.

◆ clear()

template<typename T , typename grow_p >
void 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_std.hpp.

◆ deviceToHost() [1/2]

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

Do nothing.

Definition at line 852 of file map_vector_std.hpp.

◆ deviceToHost() [2/2]

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

Do nothing.

Definition at line 859 of file map_vector_std.hpp.

◆ duplicate()

template<typename T , typename grow_p >
openfpm::vector< T > 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_std.hpp.

◆ end() [1/2]

template<typename T , typename grow_p >
auto 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_std.hpp.

◆ end() [2/2]

template<typename T , typename grow_p >
auto 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_std.hpp.

◆ erase()

template<typename T , typename grow_p >
void 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_std.hpp.

◆ fill()

template<typename T , typename grow_p >
void 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_std.hpp.

◆ get() [1/4]

template<typename T , typename grow_p >
template<unsigned int p>
T & 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_std.hpp.

◆ get() [2/4]

template<typename T , typename grow_p >
T & 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_std.hpp.

◆ get() [3/4]

template<typename T , typename grow_p >
template<unsigned int p>
const T & 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_std.hpp.

◆ get() [4/4]

template<typename T , typename grow_p >
const T & 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_std.hpp.

◆ getIterator()

template<typename T , typename grow_p >
vector_key_iterator 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 767 of file map_vector_std.hpp.

◆ getIteratorTo()

template<typename T , typename grow_p >
vector_key_iterator 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 779 of file map_vector_std.hpp.

◆ getLastError()

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

Return the last error.

Returns
erro code

Definition at line 894 of file map_vector_std.hpp.

◆ getPointer() [1/2]

template<typename T , typename grow_p >
void * 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 838 of file map_vector_std.hpp.

◆ getPointer() [2/2]

template<typename T , typename grow_p >
const void * 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 874 of file map_vector_std.hpp.

◆ hostToDevice() [1/2]

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

Do nothing.

Definition at line 846 of file map_vector_std.hpp.

◆ hostToDevice() [2/2]

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

Do nothing.

Definition at line 866 of file map_vector_std.hpp.

◆ last() [1/2]

template<typename T , typename grow_p >
T & 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_std.hpp.

◆ last() [2/2]

template<typename T , typename grow_p >
const T & 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_std.hpp.

◆ noPointers()

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

This class has pointer inside.

Returns
false

Definition at line 884 of file map_vector_std.hpp.

◆ operator!=()

template<typename T , typename grow_p >
bool 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 745 of file map_vector_std.hpp.

◆ operator=() [1/4]

template<typename T , typename grow_p >
vector< T, HeapMemory, memory_traits_lin, grow_policy_double, STD_VECTOR > & 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 689 of file map_vector_std.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 > & 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 701 of file map_vector_std.hpp.

◆ operator=() [3/4]

template<typename T , typename grow_p >
vector< T, HeapMemory, memory_traits_lin, grow_policy_double, STD_VECTOR > & 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 717 of file map_vector_std.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 > & 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 731 of file map_vector_std.hpp.

◆ operator==()

template<typename T , typename grow_p >
bool 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 757 of file map_vector_std.hpp.

◆ packMem()

template<typename T , typename grow_p >
template<int ... prp>
size_t 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 794 of file map_vector_std.hpp.

◆ remove() [1/2]

template<typename T , typename grow_p >
void 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_std.hpp.

◆ remove() [2/2]

template<typename T , typename grow_p >
void 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_std.hpp.

◆ reserve()

template<typename T , typename grow_p >
void 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_std.hpp.

◆ resize()

template<typename T , typename grow_p >
void 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_std.hpp.

◆ shrink_to_fit()

template<typename T , typename grow_p >
void 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_std.hpp.

◆ size()

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

return the size of the vector

Definition at line 133 of file map_vector_std.hpp.

◆ sort()

template<typename T , typename grow_p >
void 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_std.hpp.

◆ swap() [1/3]

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

◆ swap() [2/3]

template<typename T , typename grow_p >
void 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_std.hpp.

◆ swap() [3/3]

template<typename T , typename grow_p >
void 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_std.hpp.

◆ unique()

template<typename T , typename grow_p >
void 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_std.hpp.

◆ vector_overflow()

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

Field Documentation

◆ base

template<typename T , typename grow_p >
std::vector<T> vector< T, HeapMemory, memory_traits_lin, grow_p, STD_VECTOR >::base
private

1-D static grid

Definition at line 101 of file map_vector_std.hpp.

◆ err_code

template<typename T , typename grow_p >
size_t vector< T, HeapMemory, memory_traits_lin, grow_p, STD_VECTOR >::err_code = 0
private

Error code.

Definition at line 104 of file map_vector_std.hpp.


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