35 template<
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);
62 template<
class T,
class Key,
class Hash>
71 template<
class T,
class Key,
class Hash>
85 template<
class T,
class Key,
class Hash>
89 return this->release(iter);
93 template<
class T,
class Key,
class Hash>
107 template<
class T,
class Key,
class Hash>
111 return this->
remove(iter);
115 template<
class T,
class Key,
class Hash>
133 template<
class T,
class Key,
class Hash>
137 return this->
erase(iter);
141 template<
class T,
class Key,
class Hash>
144 for (iterator iter = this->
begin(); iter != this->
end(); ++iter)
153 template<
class T,
class Key,
class Hash>
161 parent_type::merge(static_cast<parent_type&>(source));
165 template<
class T,
class Key,
class Hash>
173 parent_type::merge(static_cast<parent_type&>(source));
179 template<
class T,
class Key,
class Hash>
182 const HashPtrTable<T, Key, Hash>& rhs
192 for (const_iterator iter = rhs.begin(); iter != rhs.end(); ++iter)
194 const Key&
k = iter.key();
195 const T* ptr = iter.val();
199 this->
set(
k,
new T(*ptr));
203 this->
set(
k,
nullptr);
209 template<
class T,
class Key,
class Hash>
210 void Foam::HashPtrTable<T, Key, Hash>::operator=
212 HashPtrTable<T, Key, Hash>&& rhs
label find(const ListType &input, const UnaryPredicate &pred, const label start=0)
Same as ListOps::find_if.
~HashPtrTable()
Destructor.
bool erase(iterator &iter)
Erase entry specified by given iterator and delete the allocated pointer.
label k
Boltzmann constant.
A HashTable of pointers to objects of type <T>, with deallocation management of the pointers...
void clear()
Clear all entries from table and delete any allocated pointers.
autoPtr< T > remove(iterator &iter)
Remove entry specified by given iterator.
autoPtr< T > release(iterator &iter)
Release ownership of the pointer and replace with a nullptr.
HashPtrTable()=default
Default construct with default table capacity.
constexpr auto end(C &c) -> decltype(c.end())
Return iterator to the end of the container c.
typename parent_type::iterator iterator
auto key(const Type &t) -> typename std::enable_if< std::is_enum< Type >::value, typename std::underlying_type< Type >::type >::type
void merge(HashPtrTable< T, Key, Hash > &source)
Attempts to extract entries from source parameter and insert them into this, does not overwrite exist...
Pointer management similar to std::unique_ptr, with some additional methods and type checking...
constexpr auto begin(C &c) -> decltype(c.begin())
Return iterator to the beginning of the container c.