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 (const exint capacity, const exint size) | |
Construct based on given capacity and size. More... | |
UT_Array (const 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 new_capacity) |
void | setCapacityIfNeeded (exint min_capacity) |
void | bumpCapacity (exint min_capacity) |
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 | shrinkToFit () |
shrinks the capacity to the current size More... | |
void | setSizeAndShrink (exint new_size) |
convenience method to set size and shrink-to-fit in a single call More... | |
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 |
template<typename ComparatorBool , typename = IsBoolComp<ComparatorBool>> | |
bool | isEqual (const UT_Array< T > &a, ComparatorBool is_equal) 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... | |
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 | |
UT_Array (const UT_ArrayCT::ExternalCapacity, T *external_data, const exint external_capacity) | |
UT_Array (const UT_ArrayCT::ExternalMove, T *external_data, const exint external_capacity, UT_Array &&a) | |
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) |
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 95 of file UT_Array.h.
typedef base_iterator<const T, true> UT_Array< T >::const_iterator |
Definition at line 999 of file UT_Array.h.
typedef base_iterator<const T, false> UT_Array< T >::const_reverse_iterator |
Definition at line 1001 of file UT_Array.h.
typedef base_iterator<T, true> UT_Array< T >::iterator |
Definition at line 998 of file UT_Array.h.
typedef base_iterator<T, false> UT_Array< T >::reverse_iterator |
Definition at line 1000 of file UT_Array.h.
typedef const_iterator UT_Array< T >::traverser |
Definition at line 1002 of file UT_Array.h.
typedef T UT_Array< T >::value_type |
Definition at line 93 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 519 of file UT_ArrayImpl.h.
Move constructor. Steals the working data from the original.
Definition at line 551 of file UT_ArrayImpl.h.
Construct based on given capacity and size.
Definition at line 558 of file UT_ArrayImpl.h.
Construct based on given capacity with a size of 0.
Definition at line 569 of file UT_ArrayImpl.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 535 of file UT_ArrayImpl.h.
Definition at line 578 of file UT_ArrayImpl.h.
|
explicitprotected |
Definition at line 595 of file UT_ArrayImpl.h.
|
explicitprotected |
Definition at line 607 of file UT_ArrayImpl.h.
|
inline |
Definition at line 1845 of file UT_ArrayImpl.h.
This method allows you to swap in a new raw T array, which must be the same size as capacity(). Use caution with this method.
Definition at line 847 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 142 of file UT_Array.h.
Definition at line 143 of file UT_Array.h.
Definition at line 144 of file UT_Array.h.
Definition at line 145 of file UT_Array.h.
Definition at line 786 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 746 of file UT_ArrayImpl.h.
Definition at line 795 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 1549 of file UT_ArrayImpl.h.
Definition at line 839 of file UT_Array.h.
Definition at line 840 of file UT_Array.h.
Begin iterating over the array. The contents of the array may be modified during the traversal.
Definition at line 1006 of file UT_Array.h.
|
inline |
Begin iterating over the array. The array may not be modified during the traversal.
Definition at line 1019 of file UT_Array.h.
If the capacity is smaller than min_capacity, expand the array to at least min_capacity 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 612 of file UT_Array.h.
NOTE: bumpEntries() will be deprecated in favour of bumpSize() in a future version.
Definition at line 636 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 629 of file UT_Array.h.
Query the capacity, i.e. the allocated length of the array. NOTE: capacity() >= size().
Definition at line 143 of file UT_ArrayImpl.h.
Resets list to an empty list.
Definition at line 729 of file UT_Array.h.
|
inline |
Remove all matching elements. Also sets the capacity of the array.
Definition at line 408 of file UT_Array.h.
Takes another T array and concatenate it onto my end.
Definition at line 982 of file UT_ArrayImpl.h.
Takes another T array and concatenate it onto my end.
Definition at line 993 of file UT_ArrayImpl.h.
Quickly set the array to a single value.
Definition at line 1272 of file UT_ArrayImpl.h.
|
inlinestaticprotected |
Definition at line 1150 of file UT_Array.h.
|
inlinestaticprotected |
Definition at line 1156 of file UT_Array.h.
Cyclically shifts the entire array by how_many.
Definition at line 1244 of file UT_ArrayImpl.h.
Definition at line 843 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 769 of file UT_ArrayImpl.h.
End iterator.
Definition at line 1011 of file UT_Array.h.
|
inline |
End const iterator. Consider using it.atEnd() instead.
Definition at line 1024 of file UT_Array.h.
Alias of size(). size() is preferred.
Definition at line 648 of file UT_Array.h.
Alias of setSize(). setSize() is preferred.
Definition at line 686 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 1126 of file UT_ArrayImpl.h.
|
inline |
Search for s linearly using the '==' operator, starting at index start.
Definition at line 1302 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 1087 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 811 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 801 of file UT_Array.h.
Definition at line 836 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 657 of file UT_Array.h.
Definition at line 837 of file UT_Array.h.
|
inline |
Definition at line 1653 of file UT_ArrayImpl.h.
|
inline |
Definition at line 1643 of file UT_ArrayImpl.h.
Assuming the array is already a heap, return the top (maximum) element.
Definition at line 346 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 945 of file UT_ArrayImpl.h.
|
inline |
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 928 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 445 of file UT_Array.h.
Definition at line 721 of file UT_ArrayImpl.h.
Definition at line 155 of file UT_Array.h.
Definition at line 157 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 362 of file UT_Array.h.
|
inlineprotected |
Similar to appendImpl() but for insertion.
Definition at line 1039 of file UT_ArrayImpl.h.
Returns true iff there are no occupied elements in the array.
Definition at line 650 of file UT_Array.h.
|
inline |
Definition at line 1529 of file UT_ArrayImpl.h.
|
inline |
Definition at line 1542 of file UT_ArrayImpl.h.
Returns true if the data used by the array was allocated on the heap.
Definition at line 1099 of file UT_Array.h.
|
inlinestaticprotected |
Definition at line 1109 of file UT_Array.h.
Return true if given index is valid.
Definition at line 366 of file UT_Array.h.
Definition at line 816 of file UT_Array.h.
Definition at line 821 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 1569 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 1162 of file UT_ArrayImpl.h.
Insert an element "count" times at the given index. Return the index.
Definition at line 1013 of file UT_ArrayImpl.h.
Definition at line 1521 of file UT_ArrayImpl.h.
Subscript operator NOTE: This does NOT do any bounds checking unless paranoid asserts are enabled.
Definition at line 767 of file UT_Array.h.
Const subscript operator NOTE: This does NOT do any bounds checking unless paranoid asserts are enabled.
Definition at line 775 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 1455 of file UT_ArrayImpl.h.
|
inline |
Replace the contents with those from the initializer_list ilist.
Definition at line 1470 of file UT_ArrayImpl.h.
Move the contents of array a to this array.
Definition at line 1490 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 1510 of file UT_ArrayImpl.h.
Subscript operator NOTE: This does NOT do any bounds checking unless paranoid asserts are enabled.
Definition at line 784 of file UT_Array.h.
Const subscript operator NOTE: This does NOT do any bounds checking unless paranoid asserts are enabled.
Definition at line 792 of file UT_Array.h.
|
inline |
Definition at line 1053 of file UT_Array.h.
|
inline |
Definition at line 1055 of file UT_Array.h.
|
inline |
Begin iterating over the array in reverse.
Definition at line 1031 of file UT_Array.h.
|
inline |
Begin iterating over the array in reverse.
Definition at line 1042 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 1212 of file UT_ArrayImpl.h.
Definition at line 375 of file UT_Array.h.
|
inline |
Remove item specified by the reverse_iterator.
Definition at line 1064 of file UT_Array.h.
|
inline |
Definition at line 379 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 1108 of file UT_ArrayImpl.h.
|
inline |
End reverse iterator.
Definition at line 1037 of file UT_Array.h.
|
inline |
End reverse iterator. Consider using it.atEnd() instead.
Definition at line 1048 of file UT_Array.h.
Reverses the array by swapping elements in mirrored locations.
Definition at line 1327 of file UT_ArrayImpl.h.
|
inline |
Definition at line 1058 of file UT_Array.h.
|
inline |
Definition at line 1060 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 446 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 1344 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 1361 of file UT_ArrayImpl.h.
Definition at line 603 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 666 of file UT_Array.h.
convenience method to set size and shrink-to-fit in a single call
Definition at line 716 of file UT_Array.h.
Definition at line 679 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 695 of file UT_Array.h.
shrinks the capacity to the current size
Definition at line 710 of file UT_Array.h.
Query the size, i.e. the number of occupied elements in the array. NOTE: capacity() >= size().
Definition at line 646 of file UT_Array.h.
|
inline |
Sort using std::sort with bool comparator. Defaults to operator<().
Definition at line 456 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 1336 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 587 of file UT_Array.h.
exint UT_Array< T >::sortedFind | ( | const T & | t, |
Comparator | compare | ||
) | const |
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 1313 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 819 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 827 of file UT_ArrayImpl.h.
|
inline |
Definition at line 1744 of file UT_ArrayImpl.h.
|
inline |
Definition at line 1756 of file UT_ArrayImpl.h.
|
inline |
Definition at line 1682 of file UT_ArrayImpl.h.
|
inline |
Definition at line 1689 of file UT_ArrayImpl.h.
Assuming this array is sorted, remove all duplicate elements. Returns the number of elements removed.
Definition at line 1836 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 1802 of file UT_ArrayImpl.h.
|
inline |
Definition at line 1773 of file UT_ArrayImpl.h.
|
inline |
Definition at line 1785 of file UT_ArrayImpl.h.
|
inline |
Definition at line 1699 of file UT_ArrayImpl.h.
|
inline |
Definition at line 1706 of file UT_ArrayImpl.h.
|
inline |
Definition at line 1717 of file UT_ArrayImpl.h.
|
inline |
Definition at line 1727 of file UT_ArrayImpl.h.
|
inline |
Definition at line 1665 of file UT_ArrayImpl.h.
|
inline |
Definition at line 1672 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 549 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 485 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 562 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 537 of file UT_Array.h.
|
inline |
Like stableSort, but operates on a subset of the array.
Definition at line 496 of file UT_Array.h.
|
inline |
Sort using std::sort. The ComparatorBool uses the less-than semantics.
Definition at line 471 of file UT_Array.h.
Definition at line 676 of file UT_ArrayImpl.h.
Decreases, but never expands, to the given maxsize.
Definition at line 723 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 899 of file UT_ArrayImpl.h.
|
inline |
Definition at line 921 of file UT_ArrayImpl.h.
|
inline |
Definition at line 233 of file UT_Array.h.
|
inline |
Definition at line 876 of file UT_ArrayImpl.h.
|
inline |
Definition at line 242 of file UT_Array.h.
|
inlineprotected |
Definition at line 853 of file UT_ArrayImpl.h.
Definition at line 1091 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 1073 of file UT_Array.h.
Definition at line 1079 of file UT_Array.h.
|
inline |
Definition at line 1085 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 1131 of file UT_Array.h.
Base case for validateEmplaceArgs().
Definition at line 1144 of file UT_Array.h.
Zeros the array if a POD type, else trivial constructs if a class type.
Definition at line 1287 of file UT_ArrayImpl.h.
|
friend |
Definition at line 1426 of file UT_Array.h.
Friend specialization of std::swap() to use UT_String::swap()
Definition at line 1374 of file UT_Array.h.