13 #ifndef __UT_VALARRAY_H_INCLUDED__
14 #define __UT_VALARRAY_H_INCLUDED__
27 #include <initializer_list>
44 typedef int (*Comparator)(
const T *,
const T *);
120 stableSort(compareElementsBool);
138 template<
typename ComparatorBool>
148 template <
typename ComparatorBool>
155 return selectNthLargest(idx, Less());
162 template <
typename ComparatorBool>
169 return uniqueSortedFind(item, Less());
173 return uniqueSortedFind(item);
181 template <
typename ComparatorBool>
190 return sortedInsert(t, Less());
198 template <
typename ComparatorBool>
207 return uniqueSortedInsert(t, Less());
211 return uniqueSortedInsert(t);
214 template <
typename ComparatorBool>
219 ComparatorBool is_less)
229 merge(other, direction, allow_dups, Less());
234 template <
typename F>
235 using IsBoolComp = decltype(std::declval<F>()(std::declval<T>(),
247 other, compareElements);
250 bool hasSortedSubset(
256 template <
typename ComparatorBool,
typename = IsBoolComp<ComparatorBool>>
258 ComparatorBool is_less)
const
275 template <
typename ComparatorBool,
typename = IsBoolComp<ComparatorBool>>
278 ComparatorBool is_less)
288 other, result, compareElements);
298 template <
typename ComparatorBool,
typename = IsBoolComp<ComparatorBool>>
302 ComparatorBool is_less)
const
319 template <
typename ComparatorBool,
typename = IsBoolComp<ComparatorBool>>
322 ComparatorBool is_less)
333 other, result, compareElements);
343 template <
typename ComparatorBool,
typename = IsBoolComp<ComparatorBool>>
347 ComparatorBool is_less)
const
356 other, compareElements);
365 template <
typename ComparatorBool,
typename = IsBoolComp<ComparatorBool>>
368 ComparatorBool is_less)
379 other, result, compareElements);
388 other, result, compare);
390 template <
typename ComparatorBool,
typename = IsBoolComp<ComparatorBool>>
394 ComparatorBool is_less)
const
397 other, result, is_less);
418 return this->removeIf(isElementZero);
424 this->collapseIf(isElementZero);
447 bool operator()(
const T& lhs,
const T& rhs)
const
448 {
return lhs < rhs; }
478 #define UT_DECL_ARITHMETIC_SPECIALIZATION(T) \
479 template <> UT_API T UT_ValArray<T>::sum() const; \
480 template <> UT_API void UT_ValArray<T>::display() const; \
486 #undef UT_DECL_ARITHMETIC_SPECIALIZATION
491 const char *
const *b)
493 if (*a && *b)
return strcmp(*a, *b);
511 template <
typename T>
512 struct DefaultClearer;
514 template <
typename T>
523 static const bool clearNeedsDestruction =
false;
527 #endif // __UT_VALARRAY_H_INCLUDED__
UT_ValArray & operator=(UT_Array< T > &&src)
#define UT_DECL_ARITHMETIC_SPECIALIZATION(T)
UT_ValArray(exint capacity=0)
GLboolean GLboolean GLboolean b
void merge(const UT_Array< T > &other, int direction, bool allow_dups, ComparatorBool is_less)
UT_ValArray & operator=(UT_ValArray< T > &&src)
void merge(const UT_Array< T > &other, int direction, bool allow_dups, ComparatorBool is_less={})
void sortedSetDifference(const UT_ValArray< T > &other, UT_ValArray< T > &result, ComparatorBool is_less) const
UT_ValArray & operator=(std::initializer_list< T > src)
UT_ValArray & operator=(const UT_Array< T > &src)
static void clearConstruct(UT_ValArray< T > *p)
#define SYS_DEPRECATED(__V__)
#define SYS_PRAGMA_PUSH_WARN()
void stableSort(ComparatorBool is_less={})
UT_API int UTcompareFloats(const float *a, const float *b)
*get result *(waiting if necessary)*A common idiom is to fire a bunch of sub tasks at the and then *wait for them to all complete We provide a helper class
void sortedIntersection(const UT_ValArray< T > &other, UT_ValArray< T > &result, ComparatorBool is_less) const
auto printf(const S &fmt, const T &...args) -> int
#define SYS_DEPRECATED_PUSH_DISABLE()
UT_Array< T > & operator=(const UT_Array< T > &a)
IMF_EXPORT IMATH_NAMESPACE::V3f direction(const IMATH_NAMESPACE::Box2i &dataWindow, const IMATH_NAMESPACE::V2f &pixelPosition)
#define SYS_DEPRECATED_POP_DISABLE()
#define SYS_DEPRECATED_HDK_REPLACE(__V__, __R__)
exint uniqueSortedFind(const T &item, ComparatorBool is_less={}) const
UT_API int UTcompareInts(const int *a, const int *b)
UT_ValArray< const char * > UT_StringList
exint uniqueSortedInsert(const T &t, Comparator compare)
static bool compareElementsBool(const T &a, const T &b)
T heapPop(Comparator compare)
void sortedUnion(const UT_Array< T > &other, ComparatorBool is_less={})
#define SYS_PRAGMA_DISABLE_DEPRECATED()
void sortedUnion(const UT_ValArray< T > &other, UT_ValArray< T > &result, ComparatorBool is_less) const
CompareResults OIIO_API compare(const ImageBuf &A, const ImageBuf &B, float failthresh, float warnthresh, ROI roi={}, int nthreads=0)
static bool isClear(const UT_ValArray< T > &v)
void setCapacity(exint newcapacity)
UT_API float UTgetCompareFloatsTolerance()
void sort(ComparatorBool is_less={})
Sort using std::sort with bool comparator. Defaults to operator<().
exint uniqueSortedFind(const T &item, ComparatorBool is_less) const
UT_ValArray & operator=(const UT_ValArray< T > &src)
UT_ValArray(exint capacity, exint entries)
GLboolean GLboolean GLboolean GLboolean a
exint sortedInsert(const T &t, Comparator compare)
UT_ValArray(const UT_ValArray< T > &src)
T sum() const
Functions which are only specialized for int{32,64}, fpreal{32,64}.
UT_SWAPPER_TEMPLATE(UT_ValArray)
typedef int(WINAPI *PFNWGLRELEASEPBUFFERDCARBPROC)(HPBUFFERARB hPbuffer
static int compareElements(const T *a, const T *b)
void sortedSetDifference(const UT_ValArray< T > &other, ComparatorBool is_less)
#define SYS_PRAGMA_POP_WARN()
#define SYS_DEPRECATED_HDK(__V__)
exint sortedRemoveDuplicates()
void sortedSetDifference(const UT_Array< T > &other, ComparatorBool is_less={})
UT_ValArray(UT_Array< T > &&src) noexcept
void sortedIntersection(const UT_ValArray< T > &other, ComparatorBool is_less)
static bool isElementZero(const T &a)
void stableSort(ComparatorBool is_less)
UT_API int UTcomparePointers(void *const *a, void *const *b)
T selectNthLargest(exint idx, ComparatorBool is_less={})
void merge(const UT_ValArray< T > &other, int direction, bool allow_dups)
bool hasSortedSubset(const UT_Array< T > &other, ComparatorBool is_less) const
void sortedUnion(const UT_ValArray< T > &other, ComparatorBool is_less)
T selectNthLargest(int idx, ComparatorBool is_less)
exint sortAndRemoveDuplicates()
void sortedIntersection(const UT_Array< T > &other, ComparatorBool is_less={})
exint uniqueSortedFind(const T &item) const
exint uniqueSortedFindAscending(const T &item) const
exint uniqueSortedFind(const T &item, Comparator compare) const
static void clear(UT_ValArray< T > &v)
T heapPop(Comparator compare)
UT_ValArray(UT_ValArray< T > &&src) noexcept
exint heapPush(const T &t, Comparator compare)
UT_ValArray(const UT_Array< T > &src)
void display() const
Prints the constents of the array.
UT_ValArray(std::initializer_list< T > init)
UT_API void UTsetCompareFloatsTolerance(float tol)
bool hasSortedSubset(const UT_Array< T > &other, ComparatorBool is_less={}) const
T selectNthLargest(int idx)