34 template<
typename >
class BUFFER_TYPE >
194 using ParentClass::operator[];
195 using ParentClass::operator();
241 template<
typename ITER >
242 INDEX_TYPE
insert( ITER
const first, ITER
const last )
249 this->
m_size += nInserted;
259 bool remove( T
const & value )
277 template<
typename ITER >
278 INDEX_TYPE
remove( ITER
const first, ITER
const last )
338 { this->
m_values.template setName< decltype( *this ) >( name ); }
356 CallBacks( BUFFER_TYPE< T > & buffer, INDEX_TYPE
const size ):
369 T * incrementSize( T *
const curPtr,
370 INDEX_TYPE
const nToAdd )
const 374 return m_buffer.data();
379 BUFFER_TYPE< T > & m_buffer;
400 template<
typename >
class BUFFER_TYPE >
401 constexpr
bool isSortedArray< SortedArray< T, INDEX_TYPE, BUFFER_TYPE > > =
true;
#define LVARRAY_UNUSED_VARIABLE(X)
Mark X as an unused variable, used to silence compiler warnings.
void move(MemorySpace const space, bool touch=true) const
Moves the SortedArrayView to the given execution space.
bool contains(T const &value) const
void reserve(BUFFER &buf, std::ptrdiff_t const size, std::ptrdiff_t const newCapacity)
Reserve space in the buffer for at least the given capacity.
constexpr ArraySlice< T const, 1, 0, INDEX_TYPE > toSlice() const &
BUFFER_TYPE< T > m_values
Holds the array of values.
constexpr SortedArrayView< T const, INDEX_TYPE, BUFFER_TYPE > toViewConst() const
SortedArray & operator=(SortedArray const &src)
Copy assignment operator, performs a deep copy.
INDEX_TYPE m_size
The number of values.
void move(MemorySpace const space, bool const touch=true) const
Moves the SortedArrayView to the given execution space.
SortedArrayView< T const, INDEX_TYPE, BUFFER_TYPE > toView() const &
void dynamicReserve(BUFFER &buf, std::ptrdiff_t const size, std::ptrdiff_t const newCapacity)
If the buffer's capacity is greater than newCapacity this is a no-op. Otherwise the buffer's capacity...
This class provides an interface similar to an std::set.
~SortedArray()
Destructor, frees the values array.
SortedArray()
Default constructor.
void copyInto(DST_BUFFER &dst, std::ptrdiff_t const dstSize, SRC_BUFFER const &src, std::ptrdiff_t const srcSize)
Copy values from the source buffer into the destination buffer.
constexpr T const * begin() const
constexpr bool isSortedArray
True if the template type is a SortedArray.
bool insert(T const &value)
Insert the given value into the array if it doesn't already exist.
bool count(T const &value) const
INDEX_TYPE size_type
The integer type used for indexing, here for stl compatability.
SortedArrayView< T const, INDEX_TYPE, BUFFER_TYPE > toViewConst() const &
constexpr SortedArrayView< T const, INDEX_TYPE, BUFFER_TYPE > toView() const
SortedArray(SortedArray const &src)
The copy constructor, performs a deep copy.
This class provides a no-op callbacks interface for the ArrayManipulation sorted routines.
void free(BUFFER &buf, std::ptrdiff_t const size)
Destroy the values in the buffer and free it's memory.
constexpr T const * data() const
constexpr T const * end() const
bool remove(T *const LVARRAY_RESTRICT ptr, std::ptrdiff_t const size, T const &value, CALLBACKS &&callBacks)
Remove the given value from the array if it exists.
constexpr INDEX_TYPE size() const
bool insert(T *const LVARRAY_RESTRICT ptr, std::ptrdiff_t const size, T const &value, CALLBACKS &&callBacks=CALLBACKS())
Insert the given value into the array if it doesn't already exist.
T value_type
The type of the values contained in the SortedArrayView, here for stl compatability.
INDEX_TYPE insert(ITER const first, ITER const last)
Insert the values in [ first, last ) into the array if they don't already exist.
constexpr INDEX_TYPE size() const
MemorySpace
An enum containing the available memory spaces.
void setName(std::string const &name)
Set the name to be displayed whenever the underlying Buffer's user call back is called.
Contains the implementation of LvArray::SortedArrayView.
void clear()
Remove all the values from the array.
INDEX_TYPE IndexType
The integer type used for indexing.
T ValueType
The type of the values contained in the SortedArrayView.
constexpr bool empty() const
constexpr T const * data() const
std::string string
String type.
void reserve(INDEX_TYPE const nVals)
Reserve space to store the given number of values without resizing.
This class provides a view into a SortedArray.
void resize(BUFFER &buf, std::ptrdiff_t const size, std::ptrdiff_t const newSize, ARGS &&... args)
Resize the buffer to the given size.
#define LVARRAY_HOST_DEVICE
Mark a function for both host and device usage.