|
LvArray
|
Contains functions for operating on a contiguous sorted unique array of values. More...
Classes | |
| class | CallBacks |
| This class provides a no-op callbacks interface for the ArrayManipulation sorted routines. More... | |
| class | greater |
| This class operates as functor similar to std::greater. More... | |
| class | less |
| This class operates as functor similar to std::less. More... | |
Enumerations | |
| enum | Description { SORTED_UNIQUE, UNSORTED_NO_DUPLICATES, SORTED_WITH_DUPLICATES, UNSORTED_WITH_DUPLICATES } |
| Describes an as some combination of sorted/unsorted and unique/with duplicates. | |
Functions | |
| LVARRAY_HOST_DEVICE constexpr bool | isSorted (Description const desc) |
| LVARRAY_HOST_DEVICE constexpr bool | isUnique (Description const desc) |
| template<typename RandomAccessIterator , typename Compare = less< typename std::iterator_traits< RandomAccessIterator >::value_type >> | |
| DISABLE_HD_WARNING LVARRAY_HOST_DEVICE void | makeSorted (RandomAccessIterator const first, RandomAccessIterator const last, Compare &&comp=Compare()) |
| Sort the given values in place using the given comparator. More... | |
| template<typename RandomAccessIteratorA , typename RandomAccessIteratorB , typename Compare = less< typename std::iterator_traits< RandomAccessIteratorA >::value_type >> | |
| DISABLE_HD_WARNING LVARRAY_HOST_DEVICE void | dualSort (RandomAccessIteratorA valueFirst, RandomAccessIteratorA valueLast, RandomAccessIteratorB dataFirst, Compare &&comp=Compare()) |
| Sort the given values in place using the given comparator and perform the same operations on the data array thus preserving the mapping between values[i] and data[i]. More... | |
| template<typename ITER , typename Compare = less< typename std::iterator_traits< ITER >::value_type >> | |
| DISABLE_HD_WARNING LVARRAY_HOST_DEVICE bool | isSorted (ITER first, ITER const last, Compare &&comp=Compare()) |
| template<typename ITER , typename Compare = less< typename std::iterator_traits< ITER >::value_type >> | |
| DISABLE_HD_WARNING LVARRAY_HOST_DEVICE std::ptrdiff_t | removeDuplicates (ITER first, ITER const last, Compare &&comp=Compare()) |
| Remove duplicates from the array, duplicates aren't destroyed but they're moved out of. More... | |
| template<typename ITER , typename Compare = less< typename std::iterator_traits< ITER >::value_type >> | |
| DISABLE_HD_WARNING LVARRAY_HOST_DEVICE std::ptrdiff_t | makeSortedUnique (ITER const first, ITER const last, Compare &&comp=Compare()) |
| Sort and remove duplicates from the array, duplicates aren't destroyed but they're moved out of. More... | |
| template<typename ITER , typename Compare = less< typename std::iterator_traits< ITER >::value_type >> | |
| DISABLE_HD_WARNING LVARRAY_HOST_DEVICE bool | isSortedUnique (ITER first, ITER const last, Compare &&comp=Compare()) |
| template<typename T , typename Compare = less< T >> | |
| DISABLE_HD_WARNING LVARRAY_HOST_DEVICE std::ptrdiff_t | find (T const *const LVARRAY_RESTRICT ptr, std::ptrdiff_t const size, T const &value, Compare &&comp=Compare()) |
| template<typename T , typename Compare = less< T >> | |
| DISABLE_HD_WARNING LVARRAY_HOST_DEVICE bool | contains (T const *const LVARRAY_RESTRICT ptr, std::ptrdiff_t const size, T const &value, Compare &&comp=Compare()) |
| template<typename T , typename CALLBACKS > | |
| DISABLE_HD_WARNING LVARRAY_HOST_DEVICE 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. More... | |
| template<typename T , typename ITER , typename CALLBACKS = CallBacks< T >> | |
| DISABLE_HD_WARNING LVARRAY_HOST_DEVICE std::ptrdiff_t | remove (T *const LVARRAY_RESTRICT ptr, std::ptrdiff_t const size, ITER const first, ITER const last, CALLBACKS &&callBacks=CALLBACKS()) |
| Remove the given values from the array if they exist. More... | |
| template<typename T , typename CALLBACKS = CallBacks< T >> | |
| DISABLE_HD_WARNING LVARRAY_HOST_DEVICE 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. More... | |
| template<typename T , typename ITER , typename CALLBACKS = CallBacks< T >> | |
| DISABLE_HD_WARNING LVARRAY_HOST_DEVICE std::ptrdiff_t | insert (T *const LVARRAY_RESTRICT ptr, std::ptrdiff_t const size, ITER const first, ITER const last, CALLBACKS &&callBacks=CALLBACKS()) |
| Insert the given values into the array if they don't already exist. More... | |
Contains functions for operating on a contiguous sorted unique 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 and sorted unique. Values past the end of the array are expected to be uninitialized.
|
inline |
| T | the type of values in the array. |
| Compare | the type of the comparison function, defaults to less<T>. |
value is contained in the array. | ptr | Pointer to the array, must be sorted under comp. |
| size | The size of the array. |
| value | The value to find. |
| comp | The comparison method to use. |
|
inline |
Sort the given values in place using the given comparator and perform the same operations on the data array thus preserving the mapping between values[i] and data[i].
| RandomAccessIteratorA | an iterator type that provides random access. |
| RandomAccessIteratorB | an iterator type that provides random access. |
| Compare | the type of the comparison function. |
| valueFirst | An iterator to the beginning of the values to sort. |
| valueLast | An iterator to the end of the values to sort. |
| dataFirst | An iterator to the beginning of the data. |
| comp | a function that does the comparison between two objects. |
|
inline |
| T | the type of values in the array. |
| Compare | the type of the comparison function, defaults to less<T>. |
value or size if no such element can be found. | ptr | Pointer to the array, must be sorted under comp. |
| size | The size of the array. |
| value | The value to find. |
| comp | The comparison method to use. |
|
inline |
Insert the given value into the array if it doesn't already exist.
| T | the type of values in the array. |
| CALLBACKS | the type of the callBacks class. |
| ptr | pointer to the array, must be sorted under less<T>. |
| size | the size of the array. |
| value | the value to insert. |
| callBacks | class which must define methods similar to CallBacks::incrementSize(std::ptrdiff_t) and CallBacks::insert(std::ptrdiff_t). |
|
inline |
Insert the given values into the array if they don't already exist.
| T | the type of values in the array. |
| ITER | An iterator class. |
| CALLBACKS | the type of the callBacks class. |
| ptr | pointer to the array, must be sorted under less<T>. |
| size | the size of the array. |
| first | An iterator to the first value to insert. |
| last | An iterator to the end of the values to insert. |
| callBacks | class which must define methods similar to CallBacks::incrementSize(std::ptrdiff_t), CallBacks::set(std::ptrdiff_t, std::ptrdiff_t) and CallBacks::insert(std::ptrdiff_t, std::ptrdiff_t, std::ptrdiff_t, * std::ptrdiff_t). |
first, last ) must be sorted and contain no duplicates.
|
inline |
desc describes an array that is sorted. | desc | The Description to query. |
|
inline |
| ITER | The type of the iterator to the values to check. |
| Compare | The type of the comparison function, defaults to less. |
| first | Iterator to the beginning of the values to check. |
| last | Iterator to the end of the values to check. |
| comp | The comparison method to use. |
|
inline |
| ITER | An iterator type. |
| Compare | The type of the comparison function, defaults to less. |
first, last ) is sorted under comp and contains no values which compare equal. | first | Iterator to the beginning of the values. |
| last | Iterator to the end of the values. |
| comp | The comparison method to use. |
|
inline |
desc describes an array that contains no duplicates. | desc | the Description to query. |
|
inline |
Sort the given values in place using the given comparator.
| RandomAccessIterator | an iterator type that provides random access. |
| Compare | the type of the comparison function. |
| first | An iterator to the beginning of the values to sort. |
| last | An iterator to the end of the values to sort. |
| comp | A function that does the comparison between two objects. |
|
inline |
Sort and remove duplicates from the array, duplicates aren't destroyed but they're moved out of.
| ITER | An iterator type. |
| Compare | The type of the comparison function, defaults to less. |
| first | Iterator to the beginning of the values. |
| last | Iterator to the end of the values. |
| comp | The comparison method to use. |
|
inline |
Remove the given value from the array if it exists.
| T | the type of values in the array. |
| CALLBACKS | the type of the callBacks class. |
| ptr | pointer to the array, must be sorted under less<T>. |
| size | the size of the array. |
| value | the value to remove. |
| callBacks | class which must define a method equivalent to CallBacks::remove(std::ptrdiff_t). |
|
inline |
Remove the given values from the array if they exist.
| T | the type of values in the array. |
| ITER | An iterator type. |
| CALLBACKS | the type of the callBacks class. |
| ptr | pointer to the array, must be sorted under less<T>. |
| size | the size of the array. |
| first | An iterator to the first value to insert. |
| last | An iterator to the end of the values to insert. |
| callBacks | class which must define methods equivalent to CallBacks::remove(std::ptrdiff_t, std::ptrdiff_t, std::ptrdiff_t). |
first, last ) must be sorted and contain no duplicates.
|
inline |
Remove duplicates from the array, duplicates aren't destroyed but they're moved out of.
| ITER | An iterator type. |
| Compare | The type of the comparison function, defaults to less. |
| first | Iterator to the beginning of the values. |
| last | Iterator to the end of the values. |
| comp | The comparison method to use. |
first, last ) must be sorted under comp. The following statement should be ITER next = first; ++next; This works host only however with some host compilers (clang 10.0.1 and XL) it breaks on device in release. It does some really strange things, for example last - next == 0 and they can have identical values but next != last. If you print out the array each iteration it works as expected. It's not a big deal since it amounts to just a single extra iteration, but very strange.
1.8.13