GEOSX
Functions
LvArray::arrayManipulation Namespace Reference

Contains functions for operating on a contiguous array of values. More...

Functions

template<typename INDEX_TYPE >
constexpr std::enable_if< std::is_signed< INDEX_TYPE >::value, bool >::type isPositive (INDEX_TYPE const i)
 
template<typename INDEX_TYPE >
constexpr std::enable_if< !std::is_signed< INDEX_TYPE >::value, bool >::type isPositive (INDEX_TYPE)
 
template<typename ITER >
constexpr std::iterator_traits< ITER >::difference_type iterDistance (ITER first, ITER const last, std::input_iterator_tag)
 
template<typename RandomAccessIterator >
constexpr std::iterator_traits< RandomAccessIterator >::difference_type iterDistance (RandomAccessIterator first, RandomAccessIterator last, std::random_access_iterator_tag)
 
template<typename ITER >
constexpr std::iterator_traits< ITER >::difference_type iterDistance (ITER const first, ITER const last)
 
template<typename T >
void destroy (T *const LVARRAY_RESTRICT ptr, std::ptrdiff_t const size)
 Destory the values in the array. More...
 
template<typename ITER , typename T >
void uninitializedCopy (ITER first, ITER const &last, T *LVARRAY_RESTRICT dst)
 Copy construct values from the source to the destination. More...
 
template<typename T >
void uninitializedMove (T *const LVARRAY_RESTRICT dst, std::ptrdiff_t const size, T *const LVARRAY_RESTRICT src)
 Move construct values from the source to the destination. More...
 
template<typename T >
void uninitializedShiftDown (T *const LVARRAY_RESTRICT ptr, std::ptrdiff_t const size, std::ptrdiff_t const amount)
 Shift values down into uninitialized memory. More...
 
template<typename T >
void uninitializedShiftUp (T *const LVARRAY_RESTRICT ptr, std::ptrdiff_t const size, std::ptrdiff_t const amount)
 Shift values up into uninitialized memory. More...
 
template<typename T , typename ... ARGS>
void resize (T *const LVARRAY_RESTRICT ptr, std::ptrdiff_t const size, std::ptrdiff_t const newSize, ARGS &&... args)
 Resize the give array. More...
 
template<typename T >
void shiftUp (T *const LVARRAY_RESTRICT ptr, std::ptrdiff_t const size, std::ptrdiff_t const index, std::ptrdiff_t const n)
 Shift the values in the array at or above the given position up by the given amount. New uninitialized values take their place. More...
 
template<typename T >
void shiftDown (T *const LVARRAY_RESTRICT ptr, std::ptrdiff_t const size, std::ptrdiff_t const index, std::ptrdiff_t const n)
 Shift the values in the array at or above the given position down by the given amount overwriting the existing values. The n entries at the end of the array are not destroyed. More...
 
template<typename T >
void erase (T *const LVARRAY_RESTRICT ptr, std::ptrdiff_t const size, std::ptrdiff_t const index, std::ptrdiff_t const n=1)
 Shift the values in the array at or above the given position down by the given amount overwriting the existing values. The n entries at the end of the array are then destroyed. More...
 
template<typename T , typename ... ARGS>
void emplaceBack (T *const LVARRAY_RESTRICT ptr, std::ptrdiff_t const size, ARGS &&... args)
 Append the to the array constructing the new value in place. More...
 
template<typename T , typename ITER >
std::ptrdiff_t append (T *const LVARRAY_RESTRICT ptr, std::ptrdiff_t const size, ITER first, ITER const last)
 Append the given values to the array. More...
 
template<typename T , typename ... ARGS>
void emplace (T *const LVARRAY_RESTRICT ptr, std::ptrdiff_t const size, std::ptrdiff_t const index, ARGS &&... args)
 Insert into the array constructing the new value in place. More...
 
template<typename T , typename ITERATOR >
void insert (T *const LVARRAY_RESTRICT ptr, std::ptrdiff_t const size, std::ptrdiff_t const index, ITERATOR first, std::ptrdiff_t const n)
 Insert the given values into the array at the given position. More...
 
template<typename T >
void popBack (T *const LVARRAY_RESTRICT ptr, std::ptrdiff_t const size)
 Destroy the value at the end of the array. More...
 

Detailed Description

Contains functions for operating on a contiguous array of values.

Most functions accept a pointer and a size as the first two arguments. Values in this range are expected to be in a valid state. Values past the end of the array are expected to be uninitialized. Functions that increase the size of the array expect the array to have a large enough capacity to handle the increase.

Function Documentation

◆ append()

template<typename T , typename ITER >
std::ptrdiff_t LvArray::arrayManipulation::append ( T *const LVARRAY_RESTRICT  ptr,
std::ptrdiff_t const  size,
ITER  first,
ITER const  last 
)
inline

Append the given values to the array.

Template Parameters
TThe storage type of the array.
ITERThe type of the iterators first and last.
Parameters
ptrPointer to the array.
sizeThe size of the array.
firstAn iterator to the first value to append.
lastAn iterator to the end of the values to append.
Returns
The number of values appended.

Definition at line 426 of file arrayManipulation.hpp.

◆ destroy()

template<typename T >
void LvArray::arrayManipulation::destroy ( T *const LVARRAY_RESTRICT  ptr,
std::ptrdiff_t const  size 
)
inline

Destory the values in the array.

Template Parameters
Tthe storage type of the array.
Parameters
ptrPointer to the array.
sizeThe size of the array.

Definition at line 146 of file arrayManipulation.hpp.

◆ emplace()

template<typename T , typename ... ARGS>
void LvArray::arrayManipulation::emplace ( T *const LVARRAY_RESTRICT  ptr,
std::ptrdiff_t const  size,
std::ptrdiff_t const  index,
ARGS &&...  args 
)
inline

Insert into the array constructing the new value in place.

Template Parameters
TThe storage type of the array.
ARGSVariadic pack of types to construct T with, the types of args.
Parameters
ptrPointer to the array.
sizeThe size of the array.
indexThe position to insert at.
argsThe arguments to forward to construct the new value.

Definition at line 457 of file arrayManipulation.hpp.

◆ emplaceBack()

template<typename T , typename ... ARGS>
void LvArray::arrayManipulation::emplaceBack ( T *const LVARRAY_RESTRICT  ptr,
std::ptrdiff_t const  size,
ARGS &&...  args 
)
inline

Append the to the array constructing the new value in place.

Template Parameters
TThe storage type of the array.
ARGSVariadic pack of types to construct T with, the types of args.
Parameters
ptrPointer to the array.
sizeThe size of the array.
argsThe arguments to forward to construct the new value.

Definition at line 404 of file arrayManipulation.hpp.

◆ erase()

template<typename T >
void LvArray::arrayManipulation::erase ( T *const LVARRAY_RESTRICT  ptr,
std::ptrdiff_t const  size,
std::ptrdiff_t const  index,
std::ptrdiff_t const  n = 1 
)
inline

Shift the values in the array at or above the given position down by the given amount overwriting the existing values. The n entries at the end of the array are then destroyed.

Template Parameters
Tthe storage type of the array.
Parameters
ptrPointer to the array.
sizeThe size of the array.
indexthe index at which to begin the shift.
nthe number of places to shift.

Definition at line 375 of file arrayManipulation.hpp.

◆ insert()

template<typename T , typename ITERATOR >
void LvArray::arrayManipulation::insert ( T *const LVARRAY_RESTRICT  ptr,
std::ptrdiff_t const  size,
std::ptrdiff_t const  index,
ITERATOR  first,
std::ptrdiff_t const  n 
)
inline

Insert the given values into the array at the given position.

Template Parameters
TThe storage type of the array.
ITERATORAn iterator type, the type of first.
Parameters
ptrPointer to the array.
sizeThe size of the array.
indexThe position to insert the value at.
firstIterator to the first value to insert.
nThe number of values to insert.

Definition at line 484 of file arrayManipulation.hpp.

◆ isPositive() [1/2]

template<typename INDEX_TYPE >
constexpr std::enable_if< std::is_signed< INDEX_TYPE >::value, bool >::type LvArray::arrayManipulation::isPositive ( INDEX_TYPE const  i)
inline
Template Parameters
INDEX_TYPEthe integral type to check.
Returns
Return true iff i is greater than or equal to zero.
Parameters
ithe value to check.

Definition at line 76 of file arrayManipulation.hpp.

◆ isPositive() [2/2]

template<typename INDEX_TYPE >
constexpr std::enable_if< !std::is_signed< INDEX_TYPE >::value, bool >::type LvArray::arrayManipulation::isPositive ( INDEX_TYPE  )
inline
Template Parameters
INDEX_TYPEthe integral type to check.
Returns
Returns true. This specialization for unsigned types avoids compiler warnings.

Definition at line 86 of file arrayManipulation.hpp.

◆ iterDistance() [1/3]

template<typename ITER >
constexpr std::iterator_traits< ITER >::difference_type LvArray::arrayManipulation::iterDistance ( ITER  first,
ITER const  last,
std::input_iterator_tag   
)
inline
Template Parameters
ITERAn iterator type.
Returns
The distance between two non-random access iterators.
Parameters
firstThe iterator to the beginning of the range.
lastThe iterator to the end of the range.

Definition at line 99 of file arrayManipulation.hpp.

◆ iterDistance() [2/3]

template<typename RandomAccessIterator >
constexpr std::iterator_traits< RandomAccessIterator >::difference_type LvArray::arrayManipulation::iterDistance ( RandomAccessIterator  first,
RandomAccessIterator  last,
std::random_access_iterator_tag   
)
inline
Template Parameters
ITERAn iterator type.
Returns
The distance between two random access iterators.
Parameters
firstThe iterator to the beginning of the range.
lastThe iterator to the end of the range.

Definition at line 121 of file arrayManipulation.hpp.

◆ iterDistance() [3/3]

template<typename ITER >
constexpr std::iterator_traits< ITER >::difference_type LvArray::arrayManipulation::iterDistance ( ITER const  first,
ITER const  last 
)
inline
Template Parameters
ITERAn iterator type.
Returns
The distance between two iterators.
Parameters
firstThe iterator to the beginning of the range.
lastThe iterator to the end of the range.

Definition at line 134 of file arrayManipulation.hpp.

◆ popBack()

template<typename T >
void LvArray::arrayManipulation::popBack ( T *const LVARRAY_RESTRICT  ptr,
std::ptrdiff_t const  size 
)
inline

Destroy the value at the end of the array.

Template Parameters
Tthe storage type of the array.
Parameters
ptrPointer to the array.
sizeThe size of the array.

Definition at line 512 of file arrayManipulation.hpp.

◆ resize()

template<typename T , typename ... ARGS>
void LvArray::arrayManipulation::resize ( T *const LVARRAY_RESTRICT  ptr,
std::ptrdiff_t const  size,
std::ptrdiff_t const  newSize,
ARGS &&...  args 
)
inline

Resize the give array.

Template Parameters
Tthe storage type of the array.
ARGSthe types of the arguments to forward to the constructor.
Parameters
ptrPointer to the array.
sizeThe size of the array.
newSizethe new size.
argsthe arguments to forward to construct any new elements with.

Definition at line 274 of file arrayManipulation.hpp.

◆ shiftDown()

template<typename T >
void LvArray::arrayManipulation::shiftDown ( T *const LVARRAY_RESTRICT  ptr,
std::ptrdiff_t const  size,
std::ptrdiff_t const  index,
std::ptrdiff_t const  n 
)
inline

Shift the values in the array at or above the given position down by the given amount overwriting the existing values. The n entries at the end of the array are not destroyed.

Template Parameters
Tthe storage type of the array.
Parameters
ptrPointer to the array.
sizeThe size of the array.
indexthe index at which to begin the shift.
nthe number of places to shift.

Definition at line 342 of file arrayManipulation.hpp.

◆ shiftUp()

template<typename T >
void LvArray::arrayManipulation::shiftUp ( T *const LVARRAY_RESTRICT  ptr,
std::ptrdiff_t const  size,
std::ptrdiff_t const  index,
std::ptrdiff_t const  n 
)
inline

Shift the values in the array at or above the given position up by the given amount. New uninitialized values take their place.

Template Parameters
Tthe storage type of the array.
Parameters
ptrPointer to the array.
sizeThe size of the array.
indexthe index at which to begin the shift.
nthe number of places to shift.

Definition at line 305 of file arrayManipulation.hpp.

◆ uninitializedCopy()

template<typename ITER , typename T >
void LvArray::arrayManipulation::uninitializedCopy ( ITER  first,
ITER const &  last,
T *LVARRAY_RESTRICT  dst 
)
inline

Copy construct values from the source to the destination.

Template Parameters
ITERAn iterator type.
Tthe storage type of the array.
Parameters
firstIterator to the first value to copy.
lastIterator to the end of the values to copy.
dstPointer to the destination array, must be uninitialized memory.

Definition at line 168 of file arrayManipulation.hpp.

◆ uninitializedMove()

template<typename T >
void LvArray::arrayManipulation::uninitializedMove ( T *const LVARRAY_RESTRICT  dst,
std::ptrdiff_t const  size,
T *const LVARRAY_RESTRICT  src 
)
inline

Move construct values from the source to the destination.

Template Parameters
Tthe storage type of the array.
Parameters
dstpointer to the destination array, must be uninitialized memory.
sizeThe number of values to copy.
srcpointer to the source array.

Definition at line 192 of file arrayManipulation.hpp.

◆ uninitializedShiftDown()

template<typename T >
void LvArray::arrayManipulation::uninitializedShiftDown ( T *const LVARRAY_RESTRICT  ptr,
std::ptrdiff_t const  size,
std::ptrdiff_t const  amount 
)
inline

Shift values down into uninitialized memory.

Template Parameters
Tthe storage type of the array.
Parameters
ptrPointer to the begining of the shift, values before this must be uninitialized.
sizenumber of values to shift.
amountthe amount to shift by.

Definition at line 216 of file arrayManipulation.hpp.

◆ uninitializedShiftUp()

template<typename T >
void LvArray::arrayManipulation::uninitializedShiftUp ( T *const LVARRAY_RESTRICT  ptr,
std::ptrdiff_t const  size,
std::ptrdiff_t const  amount 
)
inline

Shift values up into uninitialized memory.

Template Parameters
Tthe storage type of the array.
Parameters
ptrPointer to the begining of the shift.
sizenumber of values to shift, values after this must be uninitialized.
amountthe amount to shift by.

Definition at line 244 of file arrayManipulation.hpp.