35template<
class T,
class Key,
class Hash>
38 const HashPtrTable<T, Key, Hash>& rhs
41 parent_type(rhs.capacity())
43 for (const_iterator iter = rhs.begin(); iter != rhs.end(); ++iter)
45 const Key&
k = iter.key();
46 const T* ptr = iter.val();
50 this->
set(
k,
new T(*ptr));
54 this->
set(
k,
nullptr);
60template<
class T,
class Key,
class Hash>
63 HashPtrTable<T, Key, Hash>&& rhs
66 parent_type(std::move(rhs))
72template<
class T,
class Key,
class Hash>
81template<
class T,
class Key,
class Hash>
95template<
class T,
class Key,
class Hash>
99 return this->release(iter);
103template<
class T,
class Key,
class Hash>
109 this->parent_type::erase(iter);
117template<
class T,
class Key,
class Hash>
121 return this->remove(iter);
125template<
class T,
class Key,
class Hash>
132 if (this->parent_type::erase(iter))
143template<
class T,
class Key,
class Hash>
151template<
class T,
class Key,
class Hash>
154 for (
iterator iter = this->begin(); iter != this->end(); ++iter)
159 this->parent_type::clear();
165template<
class T,
class Key,
class Hash>
178 for (
const_iterator iter = rhs.begin(); iter != rhs.end(); ++iter)
180 const Key&
k = iter.key();
181 const T* ptr = iter.val();
185 this->set(
k,
new T(*ptr));
189 this->set(
k,
nullptr);
195template<
class T,
class Key,
class Hash>
A HashTable of pointers to objects of type <T>, with deallocation management of the pointers.
typename parent_type::iterator iterator
HashPtrTable()=default
Default construct with default table capacity.
bool erase(iterator &iter)
typename parent_type::const_iterator const_iterator
void clear()
Clear all entries from table and delete any allocated pointers.
~HashPtrTable()
Destructor.
unsigned int remove()
Remove and return the last element.
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
std::istream * release() noexcept
Return managed pointer and release ownership.
void set(List< bool > &bools, const labelUList &locations)
Set the listed locations (assign 'true').