HDK
|
#include <BV_KDOPTree.h>
Classes | |
class | base_iterator |
class | IndexedCompare |
Comparator class for stableSortIndices. More... | |
Public Types | |
typedef T | value_type |
typedef int(* | Comparator )(const T *, const T *) |
typedef base_iterator< T, true > | iterator |
typedef base_iterator< const T, true > | const_iterator |
typedef base_iterator< T, false > | reverse_iterator |
typedef base_iterator< const T, false > | const_reverse_iterator |
typedef const_iterator | traverser |
Public Member Functions | |
UT_Array (const UT_Array< T > &a) | |
UT_Array (UT_Array< T > &&a) noexcept | |
Move constructor. Steals the working data from the original. More... | |
UT_Array (exint capacity, exint size) | |
Construct based on given capacity and size. More... | |
UT_Array (exint capacity=0) | |
Construct based on given capacity with a size of 0. More... | |
UT_Array (std::initializer_list< T > init) | |
~UT_Array () | |
void | swap (UT_Array< T > &other) |
exint | append () |
exint | append (const T &t) |
exint | append (T &&t) |
exint | append (const T &t, bool check_dup) |
void | append (const T *pt, exint count) |
void | appendMultiple (const T &t, exint count) |
exint | insert (exint index) |
exint | insert (const T &t, exint i) |
exint | insert (T &&t, exint i) |
template<typename... S> | |
exint | emplace_back (S &&...s) |
exint | uniqueSortedInsert (const T &t, Comparator compare) |
template<typename ComparatorBool = Less<T>, typename = IsBoolComp<ComparatorBool>> | |
exint | uniqueSortedInsert (const T &t, ComparatorBool is_less={}) |
exint | uniqueSortedInsert (T &&t, Comparator compare) |
template<typename ComparatorBool = Less<T>, typename = IsBoolComp<ComparatorBool>> | |
exint | uniqueSortedFind (const T &item, ComparatorBool is_less={}) const |
exint | uniqueSortedFind (const T &item, Comparator compare) const |
template<typename ComparatorBool = Less<T>> | |
void | merge (const UT_Array< T > &other, int direction, bool allow_dups, ComparatorBool is_less={}) |
template<typename ComparatorBool = Less<T>, typename = IsBoolComp<ComparatorBool>> | |
bool | hasSortedSubset (const UT_Array< T > &other, ComparatorBool is_less={}) const |
template<typename ComparatorBool = Less<T>, typename = IsBoolComp<ComparatorBool>> | |
void | sortedUnion (const UT_Array< T > &other, ComparatorBool is_less={}) |
template<typename ComparatorBool = Less<T>, typename = IsBoolComp<ComparatorBool>> | |
void | sortedUnion (const UT_Array< T > &other, UT_Array< T > &result, ComparatorBool is_less={}) const |
template<typename ComparatorBool = Less<T>, typename = IsBoolComp<ComparatorBool>> | |
void | sortedIntersection (const UT_Array< T > &other, ComparatorBool is_less={}) |
template<typename ComparatorBool = Less<T>, typename = IsBoolComp<ComparatorBool>> | |
void | sortedIntersection (const UT_Array< T > &other, UT_Array< T > &result, ComparatorBool is_less={}) const |
template<typename ComparatorBool = Less<T>, typename = IsBoolComp<ComparatorBool>> | |
void | sortedSetDifference (const UT_Array< T > &other, ComparatorBool is_less={}) |
template<typename ComparatorBool = Less<T>, typename = IsBoolComp<ComparatorBool>> | |
void | sortedSetDifference (const UT_Array< T > &other, UT_Array< T > &result, ComparatorBool is_less={}) const |
bool | hasSortedSubset (const UT_Array< T > &other, Comparator compare) const |
void | sortedUnion (const UT_Array< T > &other, Comparator compare) |
void | sortedUnion (const UT_Array< T > &other, UT_Array< T > &result, Comparator compare) const |
void | sortedIntersection (const UT_Array< T > &other, Comparator compare) |
void | sortedIntersection (const UT_Array< T > &other, UT_Array< T > &result, Comparator compare) const |
void | sortedSetDifference (const UT_Array< T > &other, Comparator compare) |
void | sortedSetDifference (const UT_Array< T > &other, UT_Array< T > &result, Comparator compare) const |
exint | heapPush (const T &t, Comparator compare) |
T | heapPop (Comparator compare) |
const T & | heapMax () const |
exint | concat (const UT_Array< T > &a) |
Takes another T array and concatenate it onto my end. More... | |
exint | concat (UT_Array< T > &&a) noexcept |
Takes another T array and concatenate it onto my end. More... | |
exint | multipleInsert (exint index, exint count) |
Insert an element "count" times at the given index. Return the index. More... | |
exint | insertAt (const T &t, exint index) |
bool | isValidIndex (exint index) const |
Return true if given index is valid. More... | |
template<typename S > | |
exint | findAndRemove (const S &s) |
exint | removeIndex (exint index) |
SYS_FORCE_INLINE void | removeLast () |
void | removeRange (exint begin_i, exint end_i) |
void | extractRange (exint begin_i, exint end_i, UT_Array< T > &dest) |
template<typename IsEqual > | |
exint | removeIf (IsEqual is_equal) |
template<typename IsEqual > | |
void | collapseIf (IsEqual is_equal) |
Remove all matching elements. Also sets the capacity of the array. More... | |
void | move (exint src_idx, exint dst_idx, exint how_many) |
void | cycle (exint how_many) |
Cyclically shifts the entire array by how_many. More... | |
void | constant (const T &v) |
Quickly set the array to a single value. More... | |
void | zero () |
Zeros the array if a POD type, else trivial constructs if a class type. More... | |
template<typename S > | |
exint | find (const S &s, exint start=0) const |
exint | sortedFind (const T &t, Comparator compare) const |
void | reverse () |
Reverses the array by swapping elements in mirrored locations. More... | |
template<typename ComparatorBool = Less<T>, typename = IsBoolComp<ComparatorBool>> | |
void | sort (ComparatorBool is_less={}) |
Sort using std::sort with bool comparator. Defaults to operator<(). More... | |
void | sort (Comparator compare) |
template<typename ComparatorBool , typename = IsBoolComp<ComparatorBool>> | |
void | stdsort (ComparatorBool is_less) |
Sort using std::sort. The ComparatorBool uses the less-than semantics. More... | |
template<typename ComparatorBool = Less<T>> | |
void | stableSort (ComparatorBool is_less={}) |
template<typename ComparatorBool > | |
void | stableSortRange (ComparatorBool is_less, exint start, exint end) |
Like stableSort, but operates on a subset of the array. More... | |
template<typename I , typename ComparatorBool > | |
void | stableSortIndices (UT_Array< I > &indices, ComparatorBool is_less) const |
template<typename I , typename ComparatorBool > | |
void | stableArgSort (UT_Array< I > &indices, ComparatorBool is_less) const |
template<typename K , typename ComparatorBool > | |
void | stableSortByKey (const UT_Array< K > &keys, ComparatorBool is_less) |
exint | sortedRemoveDuplicates () |
template<typename CompareEqual > | |
exint | sortedRemoveDuplicatesIf (CompareEqual compare_equal) |
template<typename ComparatorBool = Less<T>> | |
exint | sortAndRemoveDuplicates (ComparatorBool is_less={}) |
template<typename ComparatorBool = Less<T>> | |
T | selectNthLargest (exint idx, ComparatorBool is_less={}) |
void | setCapacity (exint newcapacity) |
void | setCapacityIfNeeded (exint mincapacity) |
void | bumpCapacity (exint mincapacity) |
void | bumpSize (exint newsize) |
void | bumpEntries (exint newsize) |
exint | capacity () const |
exint | size () const |
exint | entries () const |
Alias of size(). size() is preferred. More... | |
bool | isEmpty () const |
Returns true iff there are no occupied elements in the array. More... | |
int64 | getMemoryUsage (bool inclusive=false) const |
void | setSize (exint newsize) |
void | setSizeIfNeeded (exint minsize) |
void | entries (exint newsize) |
Alias of setSize(). setSize() is preferred. More... | |
void | setSizeNoInit (exint newsize) |
void | truncate (exint maxsize) |
Decreases, but never expands, to the given maxsize. More... | |
void | clear () |
Resets list to an empty list. More... | |
UT_Array< T > & | operator= (const UT_Array< T > &a) |
UT_Array< T > & | operator= (std::initializer_list< T > ilist) |
Replace the contents with those from the initializer_list ilist. More... | |
UT_Array< T > & | operator= (UT_Array< T > &&a) |
Move the contents of array a to this array. More... | |
bool | operator== (const UT_Array< T > &a) const |
bool | operator!= (const UT_Array< T > &a) const |
int | isEqual (const UT_Array< T > &a, Comparator compare) const |
T & | operator() (exint i) |
const T & | operator() (exint i) const |
T & | operator[] (exint i) |
const T & | operator[] (exint i) const |
T & | forcedRef (exint i) |
T | forcedGet (exint i) const |
T & | last () |
const T & | last () const |
exint | apply (int(*apply_func)(T &t, void *d), void *d) |
template<typename BinaryOp > | |
T | accumulate (const T &init_value, BinaryOp add) const |
T * | getArray () const |
const T * | getRawArray () const |
T * | array () |
const T * | array () const |
T * | data () |
const T * | data () const |
T * | aliasArray (T *newdata) |
iterator | begin () |
iterator | end () |
End iterator. More... | |
const_iterator | begin () const |
const_iterator | end () const |
End const iterator. Consider using it.atEnd() instead. More... | |
reverse_iterator | rbegin () |
Begin iterating over the array in reverse. More... | |
reverse_iterator | rend () |
End reverse iterator. More... | |
const_reverse_iterator | rbegin () const |
Begin iterating over the array in reverse. More... | |
const_reverse_iterator | rend () const |
End reverse iterator. Consider using it.atEnd() instead. More... | |
UT_IteratorRange< iterator > | range () |
UT_IteratorRange< const_iterator > | range () const |
UT_IteratorRange < reverse_iterator > | rrange () |
UT_IteratorRange < const_reverse_iterator > | rrange () const |
void | removeItem (const reverse_iterator &it) |
Remove item specified by the reverse_iterator. More... | |
void | unsafeShareData (UT_Array< T > &src) |
void | unsafeShareData (T *src, exint srcsize) |
void | unsafeShareData (T *src, exint size, exint capacity) |
void | unsafeClearData () |
bool | isHeapBuffer () const |
Returns true if the data used by the array was allocated on the heap. More... | |
bool | isHeapBuffer (T *data) const |
exint | sortedInsert (const T &t, Comparator compare) |
template<typename ComparatorBool = Less<T>, typename = IsBoolComp<ComparatorBool>> | |
exint | sortedInsert (const T &t, ComparatorBool is_less={}) |
exint | index (const T &t) const |
exint | safeIndex (const T &t) const |
Protected Member Functions | |
template<typename S > | |
exint | appendImpl (S &&s) |
template<typename S > | |
exint | insertImpl (S &&s, exint index) |
Similar to appendImpl() but for insertion. More... | |
template<typename S > | |
exint | uniqueSortedInsertImpl (S &&s, Comparator compare) |
template<typename First , typename... Rest> | |
void | validateEmplaceArgs (First &&first, Rest &&...rest) const |
void | validateEmplaceArgs () const |
Base case for validateEmplaceArgs(). More... | |
Static Protected Member Functions | |
static constexpr SYS_FORCE_INLINE bool | isPOD () |
template<typename... S> | |
static void | construct (T &dst, S &&...s) |
static void | copyConstruct (T &dst, const T &src) |
static void | copyConstructRange (T *dst, const T *src, exint n) |
static void | trivialConstruct (T &dst) |
Element Constructor. More... | |
static void | trivialConstructRange (T *dst, exint n) |
static SYS_FORCE_INLINE void | trivialDestruct (T &dst) |
Element Destructor. More... | |
static void | trivialDestructRange (T *dst, exint n) |
Friends | |
template<typename OS , typename S > | |
OS & | operator<< (OS &os, const UT_Array< S > &d) |
void | swap (UT_Array< T > &a, UT_Array< T > &b) |
Definition at line 18 of file BV_KDOPTree.h.
Definition at line 79 of file UT_Array.h.
typedef base_iterator<const T, true> UT_Array< T >::const_iterator |
Definition at line 940 of file UT_Array.h.
typedef base_iterator<const T, false> UT_Array< T >::const_reverse_iterator |
Definition at line 942 of file UT_Array.h.
typedef base_iterator<T, true> UT_Array< T >::iterator |
Definition at line 939 of file UT_Array.h.
typedef base_iterator<T, false> UT_Array< T >::reverse_iterator |
Definition at line 941 of file UT_Array.h.
typedef const_iterator UT_Array< T >::traverser |
Definition at line 943 of file UT_Array.h.
typedef T UT_Array< T >::value_type |
Definition at line 77 of file UT_Array.h.
Copy constructor. It duplicates the data. It's marked explicit so that it's not accidentally passed by value. You can always pass by reference and then copy it, if needed. If you have a line like: UT_Array<int> a = otherarray; and it really does need to copy instead of referencing, you can rewrite it as: UT_Array<int> a(otherarray);
Definition at line 37 of file UT_ArrayImpl.h.
Move constructor. Steals the working data from the original.
Definition at line 69 of file UT_ArrayImpl.h.
Construct based on given capacity and size.
Definition at line 95 of file UT_Array.h.
Construct based on given capacity with a size of 0.
Definition at line 106 of file UT_Array.h.
Construct with the contents of an initializer list If you are wondering why we mark this as explicit... Imagine you have the following: void foo(int i); // 1 void foo(UT_Array<int>); // 2 Without explicit you can do this foo({1}) and function 1 will be called when you probably meant for function 2 to be called.
Definition at line 53 of file UT_ArrayImpl.h.
Definition at line 90 of file UT_ArrayImpl.h.
|
inline |
Definition at line 1246 of file UT_ArrayImpl.h.
This method allows you to swap in a new raw T array, which must be the same size as myCapacity. Use caution with this method.
Definition at line 790 of file UT_Array.h.
Append an element to the current elements and return its index in the array, or insert the element at a specified position; if necessary, insert() grows the array to accommodate the element. The insert methods use the assignment operator '=' to place the element into the right spot; be aware that '=' works differently on objects and pointers. The test for duplicates uses the logical equal operator '=='; as with '=', the behaviour of the equality operator on pointers versus objects is not the same. Use the subscript operators instead of insert() if you are appending to the array, or if you don't mind overwriting the element already inserted at the given index.
Definition at line 137 of file UT_Array.h.
Definition at line 138 of file UT_Array.h.
Definition at line 139 of file UT_Array.h.
Definition at line 140 of file UT_Array.h.
Definition at line 192 of file UT_ArrayImpl.h.
|
inlineprotected |
Implements both append(const T &) and append(T &&) via perfect forwarding. Unlike the variadic emplace_back(), its argument may be a reference to another element in the array.
Definition at line 154 of file UT_ArrayImpl.h.
Definition at line 201 of file UT_ArrayImpl.h.
|
inline |
Apply a user-defined function to each element of the array as int as the function returns zero. If apply_func returns 1, apply() stops traversing the list and returns the current index; otherwise, apply() returns the size.
Definition at line 950 of file UT_ArrayImpl.h.
Definition at line 783 of file UT_Array.h.
Begin iterating over the array. The contents of the array may be modified during the traversal.
Definition at line 947 of file UT_Array.h.
|
inline |
Begin iterating over the array. The array may not be modified during the traversal.
Definition at line 960 of file UT_Array.h.
If the capacity is smaller than mincapacity, expand the array to at least mincapacity and to at least a constant factor of the array's previous capacity, to avoid having a linear number of reallocations in a linear number of calls to bumpCapacity.
Definition at line 575 of file UT_Array.h.
NOTE: bumpEntries() will be deprecated in favour of bumpSize() in a future version.
Definition at line 599 of file UT_Array.h.
First bumpCapacity to ensure that there's space for newsize, expanding either not at all or by at least a constant factor of the array's previous capacity, then set the size to newsize.
Definition at line 592 of file UT_Array.h.
Query the capacity, i.e. the allocated length of the array. NOTE: capacity() >= size().
Definition at line 606 of file UT_Array.h.
Resets list to an empty list.
Definition at line 679 of file UT_Array.h.
|
inline |
Remove all matching elements. Also sets the capacity of the array.
Definition at line 371 of file UT_Array.h.
Takes another T array and concatenate it onto my end.
Definition at line 388 of file UT_ArrayImpl.h.
Takes another T array and concatenate it onto my end.
Definition at line 399 of file UT_ArrayImpl.h.
Quickly set the array to a single value.
Definition at line 669 of file UT_ArrayImpl.h.
|
inlinestaticprotected |
Definition at line 1095 of file UT_Array.h.
|
inlinestaticprotected |
Definition at line 1101 of file UT_Array.h.
|
inlinestaticprotected |
Definition at line 1108 of file UT_Array.h.
Cyclically shifts the entire array by how_many.
Definition at line 644 of file UT_ArrayImpl.h.
Definition at line 786 of file UT_Array.h.
Adds a new element to the array (resizing if necessary) and forwards the given arguments to T's constructor. NOTE: Unlike append(), the arguments cannot reference any existing elements in the array. Checking for and handling such cases would remove most of the performance gain versus append(T(...)). Debug builds will assert that the arguments are valid.
Definition at line 177 of file UT_ArrayImpl.h.
End iterator.
Definition at line 952 of file UT_Array.h.
|
inline |
End const iterator. Consider using it.atEnd() instead.
Definition at line 965 of file UT_Array.h.
Alias of size(). size() is preferred.
Definition at line 611 of file UT_Array.h.
Alias of setSize(). setSize() is preferred.
Definition at line 649 of file UT_Array.h.
|
inline |
Remove the range [begin_i, end_i) of elements from this array and place them in the dest array, shrinking/growing the dest array as necessary. begin_i is the start index, end_i is index to stop at, and isn't inclusive.
Definition at line 528 of file UT_ArrayImpl.h.
|
inline |
Search for s linearly using the '==' operator, starting at index start.
Definition at line 695 of file UT_ArrayImpl.h.
|
inline |
Remove one element from the array given the element itself or its position in the list, and fill the gap by shifting the elements down by one position. Return the index of the element remove or -1 if the value was not found.
Definition at line 489 of file UT_ArrayImpl.h.
forcedGet(exint) does NOT grow the array, and will return default objects for out of bound array indices.
Definition at line 754 of file UT_Array.h.
forcedRef(exint) will grow the array if necessary, initializing any new elements to zero for POD types and default constructing for class types.
Definition at line 744 of file UT_Array.h.
Definition at line 779 of file UT_Array.h.
Returns the amount of memory used by this UT_Array. If inclusive is false, it only counts the memory of the array. This is often necessary to avoid double-counting, e.g. if this UT_Array is a member variable of a class whose memory is already being counted by the caller.
Definition at line 620 of file UT_Array.h.
Definition at line 780 of file UT_Array.h.
|
inline |
Definition at line 1054 of file UT_ArrayImpl.h.
|
inline |
Definition at line 1044 of file UT_ArrayImpl.h.
Assuming the array is already a heap, return the top (maximum) element.
Definition at line 309 of file UT_Array.h.
|
inline |
Assuming the array is already a heap, extracts the top (maximum) element from the heap and returns it.
Definition at line 351 of file UT_ArrayImpl.h.
Assuming the array is already a heap, it inserts item t maintaining the heap. It returns the index of the inserted item.
Definition at line 334 of file UT_ArrayImpl.h.
The fastest search possible, which does pointer arithmetic to find the index of the element. WARNING: index() does no out-of-bounds checking.
Definition at line 408 of file UT_Array.h.
Definition at line 129 of file UT_ArrayImpl.h.
Definition at line 150 of file UT_Array.h.
Definition at line 152 of file UT_Array.h.
An alias for unique element insertion at a certain index. Also used by the other insertion methods.
Definition at line 325 of file UT_Array.h.
|
inlineprotected |
Similar to appendImpl() but for insertion.
Definition at line 441 of file UT_ArrayImpl.h.
Returns true iff there are no occupied elements in the array.
Definition at line 613 of file UT_Array.h.
|
inline |
Definition at line 936 of file UT_ArrayImpl.h.
Returns true if the data used by the array was allocated on the heap.
Definition at line 1040 of file UT_Array.h.
Definition at line 1044 of file UT_Array.h.
|
inlinestaticprotected |
Definition at line 1054 of file UT_Array.h.
Return true if given index is valid.
Definition at line 329 of file UT_Array.h.
Definition at line 759 of file UT_Array.h.
Definition at line 764 of file UT_Array.h.
|
inline |
Merge the given array into us. If direction is -1, then it assumes us and 'other' are both already sorted in descending order. Similarly, +1 means ascending. If allow_dups is false, then it further assumes that both arrays have no duplicates and will produce a result that also has no duplicates. More work will be needed if you want allow_dups to mean remove duplicates
Definition at line 970 of file UT_ArrayImpl.h.
|
inline |
Move how_many objects starting at index src_idx to dst_idx; This method will remove the elements at [src_idx, src_idx+how_many) and then insert them at dst_idx. This method can be used in place of the old shift() operation.
Definition at line 560 of file UT_ArrayImpl.h.
Insert an element "count" times at the given index. Return the index.
Definition at line 415 of file UT_ArrayImpl.h.
Definition at line 929 of file UT_ArrayImpl.h.
Subscript operator NOTE: This does NOT do any bounds checking unless paranoid asserts are enabled.
Definition at line 710 of file UT_Array.h.
Const subscript operator NOTE: This does NOT do any bounds checking unless paranoid asserts are enabled.
Definition at line 718 of file UT_Array.h.
Assign array a to this array by copying each of a's elements with memcpy for POD types, and with copy construction for class types.
Definition at line 832 of file UT_ArrayImpl.h.
|
inline |
Replace the contents with those from the initializer_list ilist.
Definition at line 852 of file UT_ArrayImpl.h.
Move the contents of array a to this array.
Definition at line 872 of file UT_ArrayImpl.h.
Compare two array and return true if they are equal and false otherwise. Two elements are checked against each other using operator '==' or compare() respectively. NOTE: The capacities of the arrays are not checked when determining whether they are equal.
Definition at line 918 of file UT_ArrayImpl.h.
Subscript operator NOTE: This does NOT do any bounds checking unless paranoid asserts are enabled.
Definition at line 727 of file UT_Array.h.
Const subscript operator NOTE: This does NOT do any bounds checking unless paranoid asserts are enabled.
Definition at line 735 of file UT_Array.h.
|
inline |
Definition at line 994 of file UT_Array.h.
|
inline |
Definition at line 996 of file UT_Array.h.
|
inline |
Begin iterating over the array in reverse.
Definition at line 972 of file UT_Array.h.
|
inline |
Begin iterating over the array in reverse.
Definition at line 983 of file UT_Array.h.
|
inline |
Removes all matching elements from the list, shuffling down and changing the size appropriately. Returns the number of elements left.
Definition at line 612 of file UT_ArrayImpl.h.
Definition at line 338 of file UT_Array.h.
|
inline |
Remove item specified by the reverse_iterator.
Definition at line 1005 of file UT_Array.h.
|
inline |
Definition at line 342 of file UT_Array.h.
Remove the range [begin_i,end_i) of elements from the array. begin_i is the start index. end_i is the index to stop at, and isn't inclusive.
Definition at line 510 of file UT_ArrayImpl.h.
|
inline |
End reverse iterator.
Definition at line 978 of file UT_Array.h.
|
inline |
End reverse iterator. Consider using it.atEnd() instead.
Definition at line 989 of file UT_Array.h.
Reverses the array by swapping elements in mirrored locations.
Definition at line 720 of file UT_ArrayImpl.h.
|
inline |
Definition at line 999 of file UT_Array.h.
|
inline |
Definition at line 1001 of file UT_Array.h.
The fastest search possible, which does pointer arithmetic to find the index of the element. WARNING: index() does no out-of-bounds checking.
Definition at line 409 of file UT_Array.h.
|
inline |
Partitions the array into values greater than or less than the Nth element, returns the resulting partition number. idx == 0 will get the minimum value, idx == size()-1 the maximum value. This does modify this array!
Definition at line 737 of file UT_ArrayImpl.h.
Set the capacity of the array, i.e. grow it or shrink it. The function copies the data after reallocating space for the array.
Definition at line 756 of file UT_ArrayImpl.h.
Definition at line 566 of file UT_Array.h.
Set the size, the number of occupied elements in the array. NOTE: This will not do bumpCapacity, so if you call this n times to increase the size, it may take n^2 time.
Definition at line 629 of file UT_Array.h.
Definition at line 642 of file UT_Array.h.
Set the size, but unlike setSize(newsize), this function will not initialize new POD elements to zero. Non-POD data types will still have their constructors called. This function is faster than setSize(ne) if you intend to fill in data for all elements.
Definition at line 658 of file UT_Array.h.
Query the size, i.e. the number of occupied elements in the array. NOTE: capacity() >= size().
Definition at line 609 of file UT_Array.h.
|
inline |
Sort using std::sort with bool comparator. Defaults to operator<().
Definition at line 419 of file UT_Array.h.
|
inline |
Sort the array using a comparison function that you must provide. t1 and t2 are pointers to Thing. The comparison function uses strcmp() semantics (i.e. -1 if less than, 0 if equal, 1 if greater).
Definition at line 729 of file UT_ArrayImpl.h.
|
inline |
Sort and then remove duplicates. By default, operator<() is used but if you supply a custom comparator, ensure that equal elements are adjacent after sorting. Returns the number of elements removed.
Definition at line 550 of file UT_Array.h.
Search for t via binary search using the function specified in the parameter list, assuming the array is already sorted with respect to compare.
Definition at line 706 of file UT_ArrayImpl.h.
Assuming the array is sorted, it inserts item t maintaining the sorted state of the array. It returns the index of the inserted item.
Definition at line 225 of file UT_ArrayImpl.h.
|
inline |
Assuming the array is sorted, it inserts item t maintaining the sorted state of the array. It returns the index of the inserted item.
Definition at line 233 of file UT_ArrayImpl.h.
|
inline |
Definition at line 1145 of file UT_ArrayImpl.h.
|
inline |
Definition at line 1157 of file UT_ArrayImpl.h.
|
inline |
Definition at line 1083 of file UT_ArrayImpl.h.
|
inline |
Definition at line 1090 of file UT_ArrayImpl.h.
Assuming this array is sorted, remove all duplicate elements. Returns the number of elements removed.
Definition at line 1237 of file UT_ArrayImpl.h.
|
inline |
Assuming this array is sorted, remove all duplicate elements using the given binary predicate. Returns the number of elements removed
Definition at line 1203 of file UT_ArrayImpl.h.
|
inline |
Definition at line 1174 of file UT_ArrayImpl.h.
|
inline |
Definition at line 1186 of file UT_ArrayImpl.h.
|
inline |
Definition at line 1100 of file UT_ArrayImpl.h.
|
inline |
Definition at line 1107 of file UT_ArrayImpl.h.
|
inline |
Definition at line 1118 of file UT_ArrayImpl.h.
|
inline |
Definition at line 1128 of file UT_ArrayImpl.h.
|
inline |
Definition at line 1066 of file UT_ArrayImpl.h.
|
inline |
Definition at line 1073 of file UT_ArrayImpl.h.
|
inline |
Create an index array from 0..n-1 into this array and sort it with stableSortIndices. The index array will be resized & rebuilt by this.
Definition at line 512 of file UT_Array.h.
|
inline |
stableSort is both stable, so keeps equal elements in the same order (note this is very useful for compatibility between compilers) and templated. Either use a bool sort function or make a utility class with bool operator()(const T a, const T b) the utility class lets you bind data to avoid globals. The comparator returns true if a must occur before b in the list. For sorting ascending, this is a less than operation.
Definition at line 448 of file UT_Array.h.
|
inline |
Sorts this array by an external key array. We assume a 1:1 corespondence between our own elements and those of the key array. The comparator should be defined on the key type.
Definition at line 525 of file UT_Array.h.
|
inline |
Sort indices array by the values indexed into this array using a stable sorting algorithm. To reorder the array in such a way that it would be sorted, or another array to be reordered the same way, include UT_Permute.h and use: UTinversePermute(values.getArray(), indices.getArray(), values.size()); The ComparatorBool uses the less-than semantics. I must be an integer type.
Definition at line 500 of file UT_Array.h.
|
inline |
Like stableSort, but operates on a subset of the array.
Definition at line 459 of file UT_Array.h.
|
inline |
Sort using std::sort. The ComparatorBool uses the less-than semantics.
Definition at line 434 of file UT_Array.h.
Definition at line 119 of file UT_ArrayImpl.h.
Element Constructor.
Definition at line 1125 of file UT_Array.h.
|
inlinestaticprotected |
Definition at line 1132 of file UT_Array.h.
|
inlinestaticprotected |
Element Destructor.
Definition at line 1155 of file UT_Array.h.
|
inlinestaticprotected |
Definition at line 1160 of file UT_Array.h.
Decreases, but never expands, to the given maxsize.
Definition at line 673 of file UT_Array.h.
|
inline |
Convenience method to perform binary search of a ascending sorted array with no duplicates. Returns the index of the specified item, -1 if not found.
Definition at line 305 of file UT_ArrayImpl.h.
|
inline |
Definition at line 327 of file UT_ArrayImpl.h.
|
inline |
Definition at line 196 of file UT_Array.h.
|
inline |
Definition at line 282 of file UT_ArrayImpl.h.
|
inline |
Definition at line 205 of file UT_Array.h.
|
inlineprotected |
Definition at line 259 of file UT_ArrayImpl.h.
Definition at line 1032 of file UT_Array.h.
Very dangerous methods to share arrays. The array is not aware of the sharing, so ensure you clear out the array prior a destructor or setCapacity operation.
Definition at line 1014 of file UT_Array.h.
Definition at line 1020 of file UT_Array.h.
|
inline |
Definition at line 1026 of file UT_Array.h.
|
inlineprotected |
In debug builds, verifies that the arguments to emplace_back() will not be invalidated when realloc() is called.
Definition at line 1076 of file UT_Array.h.
Base case for validateEmplaceArgs().
Definition at line 1089 of file UT_Array.h.
Zeros the array if a POD type, else trivial constructs if a class type.
Definition at line 684 of file UT_ArrayImpl.h.
|
friend |
Definition at line 1282 of file UT_Array.h.
Friend specialization of std::swap() to use UT_String::swap()
Definition at line 1236 of file UT_Array.h.