19 #include <hboost/unordered_set.hpp>
21 template<
typename K,
typename H,
typename P>
25 int64 mem = inclusive ?
sizeof(set) : 0;
27 mem += set.bucket_count() *
sizeof(
void*);
30 mem += set.size() * (
sizeof(size_t) +
sizeof(
void*) +
sizeof(K));
34 template<
typename K,
typename C>
38 int64 mem = inclusive ?
sizeof(set) : 0;
51 mem += (set.size() + 1) * ((3*
sizeof(
void*) +
sizeof(K)
52 + 2*
sizeof(
char) + 3) & ~3);
57 typename H = hboost::hash<K>,
typename P = std::equal_to<K> >
58 class UT_Set :
public hboost::unordered_set<K, H, P>
61 typedef hboost::unordered_set<K, H, P>
Base;
68 Base(hboost::unordered::detail::default_bucket_count, hf, eql) {}
70 template <
typename InputIt>
74 Base(first, last, hboost::unordered::detail::default_bucket_count,
82 :
Base(hboost::unordered::detail::default_bucket_count, hf, eql)
89 UT_Set(std::initializer_list<K> init,
92 :
Base(hboost::unordered::detail::default_bucket_count, hf, eql)
94 for (
auto &&p = init.begin(); p != init.end(); ++p) {
101 int64 mem = inclusive ?
sizeof(*this) : 0;
145 *
this = std::move(result);
164 template<
typename K,
typename C = std::less<K> >
175 template<
typename InputIt>
178 template<
typename InputIt>
180 Base(first, last, lt) {}
191 int64 mem = inclusive ?
sizeof(*this) : 0;
199 {
return this->
count(key) > 0; }
217 *
this = std::move(result);
233 template<
typename OS,
typename S>
235 operator<<(OS &os, const UT_Set<S> &d)
241 template<
typename OS,
typename S>
243 operator<<(OS &os, const UT_SortedSet<S> &d)
UT_Set(InputIt first, InputIt last, const Hasher &hf=Hasher(), const Equal &eql=Equal())
int64 getMemoryUsage(bool inclusive) const
UT_Set< K, H, P > & operator|=(const UT_Set< K, H, P > &src)
Set-wise boolean operations.
bool contains(const UT_SortedSet< K > &src) const
Base::const_iterator const_iterator
hboost::unordered_set< K, H, P > Base
UT_SortedSet< K, C > & operator&=(const UT_SortedSet< K, C > &src)
GA_API const UT_StringHolder P
**But if you need a result
OIIO_FORCEINLINE vbool4 insert(const vbool4 &a, bool val)
Helper: substitute val for a[i].
Base::key_compare key_compare
Base::value_type value_type
UT_SortedSet(const LessThan <)
UT_Set(const Hasher &hf=Hasher(), const Equal &eql=Equal())
bool contains(const K &key) const
UT_SortedSet(InputIt first, InputIt last)
Base::value_type value_type
bool contains(const UT_Set< K > &src) const
int64 getMemoryUsage(bool inclusive) const
Base::const_iterator const_iterator
STATIC_INLINE uint64_t H(uint64_t x, uint64_t y, uint64_t mul, int r)
int64 UTgetMemoryUsage(const hboost::unordered_set< K, H, P > &set, bool inclusive)
Base::key_equal key_equal
__hostdev__ uint64_t last(uint32_t i) const
UT_Set< K, H, P > & operator&=(const UT_Set< K, H, P > &src)
UT_SortedSet< K, C > & operator|=(const UT_SortedSet< K, C > &src)
Set-wise boolean operations.
UT_Set< K, H, P > & operator-=(const UT_Set< K, H, P > &src)
UT_SortedSet(InputIt first, InputIt last, const LessThan <)
UT_Set(std::initializer_list< K > init, const Hasher &hf=Hasher(), const Equal &eql=Equal())
bool contains(const K &key) const
UT_SortedSet< K, C > & operator-=(const UT_SortedSet< K, C > &src)
UT_Set(const K &k, const Hasher &hf=Hasher(), const Equal &eql=Equal())
PcpNodeRef_ChildrenIterator begin(const PcpNodeRef::child_const_range &r)
Support for range-based for loops for PcpNodeRef children ranges.