32 #ifndef PXR_BASE_TF_HASHSET_H
33 #define PXR_BASE_TF_HASHSET_H
38 #if defined(ARCH_HAS_GNU_STL_EXTENSIONS)
39 #include <ext/hash_set>
41 #include <unordered_set>
42 #endif // ARCH_HAS_GNU_STL_EXTENSIONS
46 #if defined(ARCH_HAS_GNU_STL_EXTENSIONS)
48 template<
class Key,
class HashFn = __gnu_cxx::hash<Key>,
49 class EqualKey = __gnu_cxx::equal_to<Key>,
50 class Alloc = __gnu_cxx::allocator<Key> >
52 private __gnu_cxx::hash_set<Key, HashFn, EqualKey, Alloc> {
53 typedef __gnu_cxx::hash_set<Key, HashFn, EqualKey, Alloc> _Base;
55 typedef typename _Base::key_type
key_type;
57 typedef typename _Base::hasher
hasher;
58 typedef typename _Base::key_equal
key_equal;
59 typedef typename _Base::size_type
size_type;
65 typedef typename _Base::iterator
iterator;
75 _Base(n, hf, eql, alloc) { }
79 template<
class InputIterator>
84 _Base(first, last, n, hf, eql, alloc) { }
95 using _Base::bucket_count;
104 std::pair<iterator,iterator> equal_range(
const key_type& key) {
105 return _Base::equal_range(key);
107 std::pair<const_iterator,const_iterator> equal_range(
const key_type& key)
const {
108 return _Base::equal_range(key);
112 _Base::erase(_MakeIterator(position));
115 _Base::erase(_MakeIterator(first), _MakeIterator(last));
122 hasher hash_function()
const {
return _Base::hash_funct(); }
128 float load_factor()
const {
129 return static_cast<float>(
static_cast<double>(
size()) / bucket_count());
131 using _Base::max_bucket_count;
132 float max_load_factor()
const {
return 1.0; }
134 using _Base::max_size;
140 template<
class Key2,
class HashFn2,
class EqualKey2,
class Alloc2>
149 return reinterpret_cast<const iterator&
>(i);
153 template<
class Key,
class HashFn = __gnu_cxx::hash<Key>,
154 class EqualKey = __gnu_cxx::equal_to<Key>,
155 class Alloc = __gnu_cxx::allocator<Key> >
157 private __gnu_cxx::hash_multiset<Key, HashFn, EqualKey, Alloc> {
158 typedef __gnu_cxx::hash_multiset<Key, HashFn, EqualKey, Alloc> _Base;
160 typedef typename _Base::key_type
key_type;
162 typedef typename _Base::hasher
hasher;
163 typedef typename _Base::key_equal
key_equal;
164 typedef typename _Base::size_type
size_type;
170 typedef typename _Base::iterator
iterator;
180 _Base(n, hf, eql, alloc) { }
184 template<
class InputIterator>
189 _Base(first, last, n, hf, eql, alloc) { }
200 using _Base::bucket_count;
209 std::pair<iterator,iterator> equal_range(
const key_type& key) {
210 return _Base::equal_range(key);
212 std::pair<const_iterator,const_iterator> equal_range(
const key_type& key)
const {
213 return _Base::equal_range(key);
217 _Base::erase(_MakeIterator(position));
220 _Base::erase(_MakeIterator(first), _MakeIterator(last));
227 hasher hash_function()
const {
return _Base::hash_funct(); }
233 float load_factor()
const {
234 return static_cast<float>(
static_cast<double>(
size()) / bucket_count());
236 using _Base::max_bucket_count;
237 float max_load_factor()
const {
return 1.0; }
239 using _Base::max_size;
245 template<
class Key2,
class HashFn2,
class EqualKey2,
class Alloc2>
254 return reinterpret_cast<const iterator&
>(i);
260 template<
class Key,
class HashFn = std::hash<Key>,
261 class EqualKey = std::equal_to<Key>,
262 class Alloc = std::allocator<Key> >
264 private std::unordered_set<Key, HashFn, EqualKey, Alloc> {
265 typedef std::unordered_set<Key, HashFn, EqualKey, Alloc> _Base;
287 _Base(n, hf, eql, alloc) { }
290 template<
class InputIterator>
295 _Base(first, last, n, hf, eql, alloc) { }
306 using _Base::bucket_count;
307 using _Base::bucket_size;
315 using _Base::equal_range;
319 _Base::erase(first, last);
323 using _Base::hash_function;
330 template<
class InputIterator>
331 void insert(InputIterator first, InputIterator last) {
335 using _Base::load_factor;
336 using _Base::max_bucket_count;
337 using _Base::max_load_factor;
339 using _Base::max_size;
345 template<
class Key2,
class HashFn2,
class EqualKey2,
class Alloc2>
351 template<
class Key,
class HashFn = std::hash<Key>,
352 class EqualKey = std::equal_to<Key>,
353 class Alloc = std::allocator<Key> >
355 private std::unordered_multiset<Key, HashFn, EqualKey, Alloc> {
356 typedef std::unordered_multiset<Key, HashFn, EqualKey, Alloc> _Base;
378 _Base(n, hf, eql, alloc) { }
381 template<
class InputIterator>
386 _Base(first, last, n, hf, eql, alloc) { }
397 using _Base::bucket_count;
398 using _Base::bucket_size;
406 using _Base::equal_range;
410 _Base::erase(first, last);
414 using _Base::hash_function;
421 template<
class InputIterator>
422 void insert(InputIterator first, InputIterator last) {
426 using _Base::load_factor;
427 using _Base::max_bucket_count;
428 using _Base::max_load_factor;
430 using _Base::max_size;
436 template<
class Key2,
class HashFn2,
class EqualKey2,
class Alloc2>
442 #endif // ARCH_HAS_GNU_STL_EXTENSIONS
444 template<
class Key,
class HashFn,
class EqualKey,
class Alloc>
452 template<
class Key,
class HashFn,
class EqualKey,
class Alloc>
457 typedef typename TfHashSet<Key, HashFn, EqualKey, Alloc>::_Base _Base;
458 return static_cast<const _Base&
>(lhs) == static_cast<const _Base&>(rhs);
461 template<
class Key,
class HashFn,
class EqualKey,
class Alloc>
466 return !(lhs == rhs);
469 template<
class Key,
class HashFn,
class EqualKey,
class Alloc>
477 template<
class Key,
class HashFn,
class EqualKey,
class Alloc>
482 typedef typename TfHashMultiSet<Key, HashFn, EqualKey, Alloc>::_Base _Base;
483 return static_cast<const _Base&
>(lhs) == static_cast<const _Base&>(rhs);
486 template<
class Key,
class HashFn,
class EqualKey,
class Alloc>
491 return !(lhs == rhs);
496 #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
_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)
FMT_CONSTEXPR auto find(Ptr first, Ptr last, T value, Ptr &out) -> bool
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.