66 #include <hboost/unordered_map.hpp>
70 template<
typename K,
typename V,
typename H,
typename P>
74 int64 mem = inclusive ?
sizeof(map) : 0;
76 mem += map.bucket_count() *
sizeof(
void*);
79 mem += map.size() * (
sizeof(size_t) +
sizeof(
void*) +
sizeof(std::pair<K,V>));
83 template<
typename K,
typename V,
typename C>
87 int64 mem = inclusive ?
sizeof(map) : 0;
99 mem += (map.size() + 1) * ((3*
sizeof(
void*) +
sizeof(std::pair<const K,V>)
100 + 2*
sizeof(
char) + 3) & ~3);
105 template<
typename K,
typename V,
106 typename H = hboost::hash<K>,
typename P = std::equal_to<K> >
107 class UT_Map :
public hboost::unordered_map<K, V, H, P>
111 typedef hboost::unordered_map<K, V, H, P>
Base;
126 Base(hboost::unordered::detail::default_bucket_count, hf, eql) {}
130 template <
typename InputIt>
134 Base(first, last, hboost::unordered::detail::default_bucket_count,
142 UT_Map(std::initializer_list<value_type> init_list)
146 this->
insert(init_list.begin(), init_list.end());
153 int64 mem = inclusive ?
sizeof(*this) : 0;
161 return this->
find(key) != this->
end();
171 auto it = this->
find(key);
172 if (it == this->
end())
196 template<
typename VIT,
typename VT>
201 template<
typename VIT,
typename VT>
207 template<
typename IT,
typename T,
typename DR>
219 template<
typename EIT,
typename EDR>
227 {
return it == o.it; }
230 {
return it != o.it; }
248 deref_pair_first<const_iterator, const key_type>>;
250 deref_pair_second<iterator, mapped_type>>;
252 deref_pair_second<const_iterator, const mapped_type>>;
280 template<
typename K,
typename V,
typename C = std::less<K> >
285 typedef std::map<K, V, C>
Base;
299 template<
typename InputIt>
302 template<
typename InputIt>
304 Base(first, last, lt) {}
313 this->
insert(init_list.begin(), init_list.end());
318 int64 mem = inclusive ?
sizeof(*this) : 0;
325 return this->
find(key) != this->
end();
329 template<
typename VIT,
typename VT>
334 template<
typename VIT,
typename VT>
340 template<
typename IT,
typename T,
typename DR>
352 template<
typename EIT,
typename EDR>
360 {
return it == o.it; }
363 {
return it != o.it; }
381 deref_pair_first<iterator, key_type>>;
383 deref_pair_first<const_iterator, const key_type>>;
385 deref_pair_second<iterator, mapped_type>>;
387 deref_pair_second<const_iterator, const mapped_type>>;
418 template<
typename OS,
typename K,
typename V>
420 operator<<(OS &os, const pair<K, V> &
v)
422 os <<
"<" <<
v.first <<
", " <<
v.second <<
">";
427 template<
typename OS,
typename K,
typename V>
429 operator<<(OS &os, const UT_Map<K, V> &d)
435 template<
typename OS,
typename K,
typename V>
437 operator<<(OS &os, const UT_SortedMap<K, V> &d)
partial_iterator_base< iterator, mapped_type, deref_pair_second< iterator, mapped_type >> mapped_iterator
UT_IteratorRange< const_key_iterator > key_range() const
int64 getMemoryUsage(bool inclusive) const
int64 getMemoryUsage(bool inclusive) const
std::forward_iterator_tag iterator_category
std::ptrdiff_t difference_type
UT_IteratorRange< IterT > UTmakeRange(IterT &&b, IterT &&e)
partial_iterator_base(const partial_iterator_base< EIT, T, EDR > &src)
VT & operator()(const VIT &v) const
std::ptrdiff_t difference_type
reference operator*() const
OIIO_FORCEINLINE vbool4 insert(const vbool4 &a, bool val)
Helper: substitute val for a[i].
partial_iterator_base & operator++()
bool operator!=(const partial_iterator_base< IT, T, DR > &o) const
UT_SortedMap(std::initializer_list< value_type > init_list)
Base::value_type value_type
UT_SortedMap(InputIt first, InputIt last)
hboost::unordered_map< K, V, H, P > Base
VT & operator()(const VIT &v) const
partial_iterator_base< iterator, key_type, deref_pair_first< iterator, key_type >> key_iterator
pointer operator->() const
bool operator!=(const partial_iterator_base< IT, T, DR > &o) const
Base::mapped_type mapped_type
partial_iterator_base< const_iterator, const key_type, deref_pair_first< const_iterator, const key_type >> const_key_iterator
UT_SortedMap(InputIt first, InputIt last, const LessThan <)
VT & operator()(const VIT &v) const
UT_IteratorRange< const_mapped_iterator > mapped_range() const
UT_Map(const Hasher &hf=Hasher(), const Equal &eql=Equal())
partial_iterator_base< const_iterator, const mapped_type, deref_pair_second< const_iterator, const mapped_type >> const_mapped_iterator
UT_IteratorRange< mapped_iterator > mapped_range()
partial_iterator_base & operator++()
STATIC_INLINE uint64_t H(uint64_t x, uint64_t y, uint64_t mul, int r)
Base::const_iterator const_iterator
int64 UTgetMemoryUsage(const hboost::unordered_map< K, V, H, P > &map, bool inclusive)
VT & operator()(const VIT &v) const
bool operator==(const partial_iterator_base< IT, T, DR > &o) const
UT_SortedMap(const LessThan <)
Base::mapped_type mapped_type
__hostdev__ uint64_t last(uint32_t i) const
std::forward_iterator_tag iterator_category
pointer operator->() const
UT_IteratorRange< const_mapped_iterator > mapped_range() const
UT_IteratorRange< key_iterator > key_range()
UT_Map(InputIt first, InputIt last, const Hasher &hf=Hasher(), const Equal &eql=Equal())
UT_IteratorRange< mapped_iterator > mapped_range()
reference operator*() const
UT_Map(std::initializer_list< value_type > init_list)
UT_IteratorRange< const_key_iterator > key_range() const
Base::value_type value_type
partial_iterator_base(IT it)
bool contains(const key_type &key) const
Base::const_iterator const_iterator
partial_iterator_base< iterator, mapped_type, deref_pair_second< iterator, mapped_type >> mapped_iterator
Base::key_compare key_compare
partial_iterator_base< const_iterator, const key_type, deref_pair_first< const_iterator, const key_type >> const_key_iterator
Base::key_equal key_equal
partial_iterator_base< const_iterator, const mapped_type, deref_pair_second< const_iterator, const mapped_type >> const_mapped_iterator
bool operator==(const partial_iterator_base< IT, T, DR > &o) const
partial_iterator_base(const partial_iterator_base< EIT, T, EDR > &src)
partial_iterator_base(IT it)
FMT_CONSTEXPR auto find(Ptr first, Ptr last, T value, Ptr &out) -> bool
bool contains(const key_type &key) const
Returns true if a value with the key is contained in the map.
PcpNodeRef_ChildrenIterator begin(const PcpNodeRef::child_const_range &r)
Support for range-based for loops for PcpNodeRef children ranges.