15 #ifndef PXR_BASE_TF_HASHSET_H
16 #define PXR_BASE_TF_HASHSET_H
21 #if defined(ARCH_HAS_GNU_STL_EXTENSIONS)
22 #include <ext/hash_set>
24 #include <unordered_set>
25 #endif // ARCH_HAS_GNU_STL_EXTENSIONS
29 #if defined(ARCH_HAS_GNU_STL_EXTENSIONS)
31 template<
class Key,
class HashFn = __gnu_cxx::hash<Key>,
32 class EqualKey = __gnu_cxx::equal_to<Key>,
33 class Alloc = __gnu_cxx::allocator<Key> >
35 private __gnu_cxx::hash_set<Key, HashFn, EqualKey, Alloc> {
36 typedef __gnu_cxx::hash_set<Key, HashFn, EqualKey, Alloc> _Base;
38 typedef typename _Base::key_type
key_type;
40 typedef typename _Base::hasher
hasher;
41 typedef typename _Base::key_equal
key_equal;
42 typedef typename _Base::size_type
size_type;
48 typedef typename _Base::iterator
iterator;
58 _Base(n, hf, eql, alloc) { }
62 template<
class InputIterator>
67 _Base(first, last, n, hf, eql, alloc) { }
78 using _Base::bucket_count;
87 std::pair<iterator,iterator> equal_range(
const key_type& key) {
88 return _Base::equal_range(key);
90 std::pair<const_iterator,const_iterator> equal_range(
const key_type& key)
const {
91 return _Base::equal_range(key);
95 _Base::erase(_MakeIterator(position));
98 _Base::erase(_MakeIterator(first), _MakeIterator(last));
105 hasher hash_function()
const {
return _Base::hash_funct(); }
111 float load_factor()
const {
112 return static_cast<float>(
static_cast<double>(
size()) / bucket_count());
114 using _Base::max_bucket_count;
115 float max_load_factor()
const {
return 1.0; }
117 using _Base::max_size;
123 template<
class Key2,
class HashFn2,
class EqualKey2,
class Alloc2>
132 return reinterpret_cast<const iterator&
>(i);
136 template<
class Key,
class HashFn = __gnu_cxx::hash<Key>,
137 class EqualKey = __gnu_cxx::equal_to<Key>,
138 class Alloc = __gnu_cxx::allocator<Key> >
140 private __gnu_cxx::hash_multiset<Key, HashFn, EqualKey, Alloc> {
141 typedef __gnu_cxx::hash_multiset<Key, HashFn, EqualKey, Alloc> _Base;
143 typedef typename _Base::key_type
key_type;
145 typedef typename _Base::hasher
hasher;
146 typedef typename _Base::key_equal
key_equal;
147 typedef typename _Base::size_type
size_type;
153 typedef typename _Base::iterator
iterator;
163 _Base(n, hf, eql, alloc) { }
167 template<
class InputIterator>
172 _Base(first, last, n, hf, eql, alloc) { }
183 using _Base::bucket_count;
192 std::pair<iterator,iterator> equal_range(
const key_type& key) {
193 return _Base::equal_range(key);
195 std::pair<const_iterator,const_iterator> equal_range(
const key_type& key)
const {
196 return _Base::equal_range(key);
200 _Base::erase(_MakeIterator(position));
203 _Base::erase(_MakeIterator(first), _MakeIterator(last));
210 hasher hash_function()
const {
return _Base::hash_funct(); }
216 float load_factor()
const {
217 return static_cast<float>(
static_cast<double>(
size()) / bucket_count());
219 using _Base::max_bucket_count;
220 float max_load_factor()
const {
return 1.0; }
222 using _Base::max_size;
228 template<
class Key2,
class HashFn2,
class EqualKey2,
class Alloc2>
237 return reinterpret_cast<const iterator&
>(i);
243 template<
class Key,
class HashFn = std::hash<Key>,
244 class EqualKey = std::equal_to<Key>,
245 class Alloc = std::allocator<Key> >
247 private std::unordered_set<Key, HashFn, EqualKey, Alloc> {
248 typedef std::unordered_set<Key, HashFn, EqualKey, Alloc> _Base;
270 _Base(n, hf, eql, alloc) { }
273 template<
class InputIterator>
278 _Base(first, last, n, hf, eql, alloc) { }
289 using _Base::bucket_count;
290 using _Base::bucket_size;
298 using _Base::equal_range;
302 _Base::erase(first, last);
306 using _Base::hash_function;
313 template<
class InputIterator>
314 void insert(InputIterator first, InputIterator last) {
318 using _Base::load_factor;
319 using _Base::max_bucket_count;
320 using _Base::max_load_factor;
322 using _Base::max_size;
328 template<
class Key2,
class HashFn2,
class EqualKey2,
class Alloc2>
334 template<
class Key,
class HashFn = std::hash<Key>,
335 class EqualKey = std::equal_to<Key>,
336 class Alloc = std::allocator<Key> >
338 private std::unordered_multiset<Key, HashFn, EqualKey, Alloc> {
339 typedef std::unordered_multiset<Key, HashFn, EqualKey, Alloc> _Base;
361 _Base(n, hf, eql, alloc) { }
364 template<
class InputIterator>
369 _Base(first, last, n, hf, eql, alloc) { }
380 using _Base::bucket_count;
381 using _Base::bucket_size;
389 using _Base::equal_range;
393 _Base::erase(first, last);
397 using _Base::hash_function;
404 template<
class InputIterator>
405 void insert(InputIterator first, InputIterator last) {
409 using _Base::load_factor;
410 using _Base::max_bucket_count;
411 using _Base::max_load_factor;
413 using _Base::max_size;
419 template<
class Key2,
class HashFn2,
class EqualKey2,
class Alloc2>
425 #endif // ARCH_HAS_GNU_STL_EXTENSIONS
427 template<
class Key,
class HashFn,
class EqualKey,
class Alloc>
435 template<
class Key,
class HashFn,
class EqualKey,
class Alloc>
440 typedef typename TfHashSet<Key, HashFn, EqualKey, Alloc>::_Base _Base;
441 return static_cast<const _Base&
>(lhs) == static_cast<const _Base&>(rhs);
444 template<
class Key,
class HashFn,
class EqualKey,
class Alloc>
449 return !(lhs == rhs);
452 template<
class Key,
class HashFn,
class EqualKey,
class Alloc>
460 template<
class Key,
class HashFn,
class EqualKey,
class Alloc>
465 typedef typename TfHashMultiSet<Key, HashFn, EqualKey, Alloc>::_Base _Base;
466 return static_cast<const _Base&
>(lhs) == static_cast<const _Base&>(rhs);
469 template<
class Key,
class HashFn,
class EqualKey,
class Alloc>
474 return !(lhs == rhs);
479 #endif // PXR_BASE_TF_HASHSET_H
void swap(ArAssetInfo &lhs, ArAssetInfo &rhs)
friend bool operator==(const TfHashMultiSet< Key2, HashFn2, EqualKey2, Alloc2 > &, const TfHashMultiSet< Key2, HashFn2, EqualKey2, Alloc2 > &)
TfHashSet & operator=(const TfHashSet &rhs)
_Base::value_type value_type
_Base::const_iterator const_iterator
TfHashSet(InputIterator first, InputIterator last, size_type n=0, const hasher &hf=hasher(), const key_equal &eql=key_equal(), const allocator_type &alloc=allocator_type())
const_iterator end() const
_Base::reference reference
iterator insert(const value_type &v)
_Base::value_type value_type
_Base::reference reference
void swap(TfHashSet &other)
_Base::const_reference const_reference
iterator insert(const_iterator hint, const value_type &v)
const_iterator cbegin() const
TfHashMultiSet(const allocator_type &alloc)
void erase(const_iterator first, const_iterator last)
TfHashSet(size_type n, const hasher &hf=hasher(), const key_equal &eql=key_equal(), const allocator_type &alloc=allocator_type())
_Base::const_iterator const_iterator
FMT_CONSTEXPR auto find(Ptr first, Ptr last, T value, Ptr &out) -> bool
_Base::size_type size_type
OIIO_FORCEINLINE vbool4 insert(const vbool4 &a, bool val)
Helper: substitute val for a[i].
void erase(const_iterator position)
const_iterator begin() const
const_iterator end() const
size_type erase(const key_type &key)
iterator insert(const_iterator hint, const value_type &v)
void swap(TfHashSet< Key, HashFn, EqualKey, Alloc > &lhs, TfHashSet< Key, HashFn, EqualKey, Alloc > &rhs)
TfHashMultiSet(size_type n, const hasher &hf=hasher(), const key_equal &eql=key_equal(), const allocator_type &alloc=allocator_type())
std::pair< iterator, bool > insert(const value_type &v)
TfHashSet(const TfHashSet &other)
bool operator!=(const Mat3< T0 > &m0, const Mat3< T1 > &m1)
Inequality operator, does exact floating point comparisons.
friend bool operator==(const TfHashSet< Key2, HashFn2, EqualKey2, Alloc2 > &, const TfHashSet< Key2, HashFn2, EqualKey2, Alloc2 > &)
_Base::key_equal key_equal
_Base::difference_type difference_type
size_type erase(const key_type &key)
const_iterator begin() const
auto reserve(std::back_insert_iterator< Container > it, size_t n) -> checked_ptr< typename Container::value_type >
_Base::allocator_type allocator_type
void erase(const_iterator first, const_iterator last)
__hostdev__ uint64_t last(uint32_t i) const
void swap(TfHashMultiSet &other)
_Base::const_pointer const_pointer
const_iterator cend() const
ImageBuf OIIO_API resize(const ImageBuf &src, string_view filtername="", float filterwidth=0.0f, ROI roi={}, int nthreads=0)
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
_Base::allocator_type allocator_type
LeafData & operator=(const LeafData &)=delete
TfHashMultiSet(InputIterator first, InputIterator last, size_type n=0, const hasher &hf=hasher(), const key_equal &eql=key_equal(), const allocator_type &alloc=allocator_type())
SIM_API const UT_StringHolder position
#define PXR_NAMESPACE_CLOSE_SCOPE
TfHashMultiSet & operator=(const TfHashMultiSet &rhs)
TfHashSet(const allocator_type &alloc)
const_iterator cend() const
void erase(const_iterator position)
const_iterator cbegin() const
_Base::size_type size_type
TfHashMultiSet(const TfHashMultiSet &other)
that also have some descendant prim *whose name begins with which in turn has a child named baz where *the predicate and *a name There is also one special expression reference
xml_allocator & get_allocator(const Object *object)
_Base::difference_type difference_type
bool operator==(const Mat3< T0 > &m0, const Mat3< T1 > &m1)
Equality operator, does exact floating point comparisons.
void insert(InputIterator first, InputIterator last)
void insert(InputIterator first, InputIterator last)
_Base::key_equal key_equal
_Base::const_pointer const_pointer
_Base::const_reference const_reference
PcpNodeRef_ChildrenIterator begin(const PcpNodeRef::child_const_range &r)
Support for range-based for loops for PcpNodeRef children ranges.