35template<
class T,
class Key,
class Hash>
38 const HashPtrTable<T, Key, Hash>& rhs
41 parent_type(
rhs.capacity())
45 const Key& k = iter.key();
46 const T* ptr = iter.val();
50 this->set(k, new T(*ptr));
54 this->set(k, nullptr);
62template<
class T,
class Key,
class Hash>
71template<
class T,
class Key,
class Hash>
85template<
class T,
class Key,
class Hash>
93template<
class T,
class Key,
class Hash>
99 this->parent_type::erase(iter);
107template<
class T,
class Key,
class Hash>
111 return this->
remove(iter);
115template<
class T,
class Key,
class Hash>
122 if (this->parent_type::erase(iter))
133template<
class T,
class Key,
class Hash>
137 return this->
erase(iter);
141template<
class T,
class Key,
class Hash>
144 for (
iterator iter = this->begin(); iter != this->end(); ++iter)
149 this->parent_type::clear();
153template<
class T,
class Key,
class Hash>
156 HashPtrTable<T, Key, Hash>& source
165template<
class T,
class Key,
class Hash>
173 parent_type::merge(
static_cast<parent_type&
>(source));
179template<
class T,
class Key,
class Hash>
182 const HashPtrTable<T, Key, Hash>&
rhs
194 const Key&
k = iter.key();
195 const T* ptr = iter.val();
199 this->
set(
k,
new T(*ptr));
203 this->set(
k,
nullptr);
209template<
class T,
class Key,
class Hash>
210void Foam::HashPtrTable<T, Key, Hash>::operator=
A HashTable of pointers to objects of type <T>, with deallocation management of the pointers.
typename parent_type::iterator iterator
constexpr HashPtrTable() noexcept=default
Default construct: empty without allocation (capacity=0).
autoPtr< T > remove(iterator &iter)
Remove entry specified by given iterator.
void merge(HashPtrTable< T, Key, Hash > &source)
Attempts to extract entries from source parameter and insert them into this, does not overwrite exist...
bool erase(iterator &iter)
Erase entry specified by given iterator and delete the allocated pointer.
bool set(const word &key, IOobject *ptr)
typename parent_type::const_iterator const_iterator
void clear()
Clear all entries from table and delete any allocated pointers.
autoPtr< T > release(iterator &iter)
Release ownership of the pointer and replace with a nullptr.
HashTable< T *, Key, Hash > parent_type
The template instance used for the parent HashTable.
~HashPtrTable()
Destructor.
iterator begin()
iterator set to the beginning of the HashTable
void merge(HashTable< T, Key, Hash > &source)
void transfer(HashTable< T, Key, Hash > &rhs)
Transfer contents into this table.
friend Ostream & operator(Ostream &, const HashTable< T, Key, Hash > &tbl)
iterator find(const Key &key)
Find and return an iterator set at the hashed entry.
bool erase(const iterator &iter)
iterator end() noexcept
iterator to signal the end (for any HashTable)
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
void rhs(fvMatrix< typename Expr::value_type > &m, const Expr &expression)
void rhs(fvMatrix< typename Expr::value_type > &m, const Expr &expression)
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)