13 #ifndef __UT_VALARRAY_H_INCLUDED__
14 #define __UT_VALARRAY_H_INCLUDED__
28 #include <initializer_list>
45 typedef int (*Comparator)(
const T *,
const T *);
143 template <
typename F>
144 using IsBoolComp = decltype(std::declval<F>()(std::declval<T>(),
147 template <
typename Y>
149 SYS_IsSame_v<Y, fpreal32>
150 || SYS_IsSame_v<Y, fpreal64>
151 || SYS_IsSame_v<Y, const char *>)>;
157 template <typename T_ = T, typename = AllowSortedSet<T_>>
162 other, compareElements);
165 bool hasSortedSubset(
171 template <
typename ComparatorBool,
typename = IsBoolComp<ComparatorBool>>
173 ComparatorBool is_less)
const
178 template <
typename T_ = T,
typename = AllowSortedSet<T_>>
191 template <
typename ComparatorBool,
typename = IsBoolComp<ComparatorBool>>
194 ComparatorBool is_less)
198 template <
typename T_ = T,
typename = AllowSortedSet<T_>>
205 other, result, compareElements);
215 template <
typename ComparatorBool,
typename = IsBoolComp<ComparatorBool>>
219 ComparatorBool is_less)
const
224 template <
typename T_ = T,
typename = AllowSortedSet<T_>>
237 template <
typename ComparatorBool,
typename = IsBoolComp<ComparatorBool>>
240 ComparatorBool is_less)
245 template <
typename T_ = T,
typename = AllowSortedSet<T_>>
252 other, result, compareElements);
262 template <
typename ComparatorBool,
typename = IsBoolComp<ComparatorBool>>
266 ComparatorBool is_less)
const
271 template <
typename T_ = T,
typename = AllowSortedSet<T_>>
276 other, compareElements);
285 template <
typename ComparatorBool,
typename = IsBoolComp<ComparatorBool>>
288 ComparatorBool is_less)
293 template <
typename T_ = T,
typename = AllowSortedSet<T_>>
300 other, result, compareElements);
309 other, result, compare);
311 template <
typename ComparatorBool,
typename = IsBoolComp<ComparatorBool>>
315 ComparatorBool is_less)
const
318 other, result, is_less);
323 static
bool isElementZero(const T &
a)
330 return this->removeIf(isElementZero);
336 this->collapseIf(isElementZero);
382 #define UT_DECL_ARITHMETIC_SPECIALIZATION(T) \
383 template <> UT_API T UT_ValArray<T>::sum() const; \
384 template <> UT_API void UT_ValArray<T>::display() const; \
390 #undef UT_DECL_ARITHMETIC_SPECIALIZATION
395 const char *
const *b)
397 if (*a && *b)
return strcmp(*a, *b);
415 template <
typename T>
416 struct DefaultClearer;
418 template <
typename T>
427 static const bool clearNeedsDestruction =
false;
431 #endif // __UT_VALARRAY_H_INCLUDED__
UT_ValArray & operator=(UT_Array< T > &&src)
#define UT_DECL_ARITHMETIC_SPECIALIZATION(T)
typedef int(APIENTRYP RE_PFNGLXSWAPINTERVALSGIPROC)(int)
UT_ValArray(exint capacity=0)
typename std::enable_if< B, T >::type enable_if_t
Define Imath::enable_if_t to be std for C++14, equivalent for C++11.
UT_ValArray & operator=(UT_ValArray< T > &&src)
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()
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)
#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)
GLboolean GLboolean GLboolean GLboolean a
UT_ValArray< const char * > UT_StringList
void setCapacity(exint new_capacity)
**But if you need a result
exint uniqueSortedInsert(const T &t, Comparator compare)
static bool compareElementsBool(const T &a, const T &b)
void sortedUnion(const UT_Array< T > &other, ComparatorBool is_less={})
#define SYS_PRAGMA_DISABLE_DEPRECATED()
#define SYS_DEPRECATED_REPLACE(__V__, __R__)
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)
UT_API float UTgetCompareFloatsTolerance()
void sort(ComparatorBool is_less={})
Sort using std::sort with bool comparator. Defaults to operator<().
UT_ValArray & operator=(const UT_ValArray< T > &src)
UT_ValArray(exint capacity, exint entries)
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)
static int compareElements(const T *a, const T *b)
void sortedSetDifference(const UT_ValArray< T > &other, ComparatorBool is_less)
#define SYS_PRAGMA_POP_WARN()
void sortedSetDifference(const UT_Array< T > &other, ComparatorBool is_less={})
GLboolean GLboolean GLboolean b
UT_ValArray(UT_Array< T > &&src) noexcept
void sortedIntersection(const UT_ValArray< T > &other, ComparatorBool is_less)
UT_API int UTcomparePointers(void *const *a, void *const *b)
bool hasSortedSubset(const UT_Array< T > &other, ComparatorBool is_less) const
void sortedUnion(const UT_ValArray< T > &other, ComparatorBool is_less)
void sortedIntersection(const UT_Array< T > &other, ComparatorBool is_less={})
exint uniqueSortedFindAscending(const T &item) const
static void clear(UT_ValArray< T > &v)
UT_ValArray(UT_ValArray< T > &&src) noexcept
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