34 template<
class T,
class Key,
class Hash>
41 template<
class T,
class Key,
class Hash>
53 template<
class T,
class Key,
class Hash>
57 const const_iterator iter(this->cfind(
key));
66 template<
class T,
class Key,
class Hash>
70 const const_iterator iter(this->cfind(
key));
79 template<
class T,
class Key,
class Hash>
80 template<
class... Args>
90 !parent_type::contains(
key)
96 template<
class T,
class Key,
class Hash>
97 template<
class... Args>
104 T* ptr =
new T(std::forward<Args>(
args)...);
105 (void)this->
set(key, ptr);
110 template<
class T,
class Key,
class Hash>
114 std::unique_ptr<T>&& ptr
127 template<
class T,
class Key,
class Hash>
144 template<
class T,
class Key,
class Hash>
151 const T* old = this->
get(
key);
155 if (ok && old != ptr)
157 delete const_cast<T*
>(old);
164 template<
class T,
class Key,
class Hash>
168 std::unique_ptr<T>&& ptr
171 return this->
set(
key, ptr.release());
175 template<
class T,
class Key,
class Hash>
182 return this->
set(
key, ptr.release());
186 template<
class T,
class Key,
class Hash>
193 return this->
set(
key, ptr.
ptr());
197 template<
class T,
class Key,
class Hash>
204 return this->
set(
key, ptr.
ptr());
srcOptions insert("case", fileName(rootDirSource/caseDirSource))
bool emplace(const Key &key, Args &&... args)
Emplace insert a new entry, not overwriting existing entries.
void set(List< bool > &bools, const labelUList &locations)
Set the listed locations (assign 'true').
A HashTable of pointers to objects of type <T>, with deallocation management of the pointers...
T * ptr() const
Return managed pointer for reuse, or clone() the object reference.
A class for managing references or pointers (no reference counting)
const T * test(const Key &key) const
Return const pointer associated with given entry or a nullptr if the key does not exist in the table...
T & emplace_set(const Key &key, Args &&... args)
Emplace set an entry, overwriting any existing entries.
bool set(const Key &key, T *ptr)
Assign a new entry, overwrites existing.
A HashTable similar to std::unordered_map.
HashPtrTable()=default
Default construct with default table capacity.
const T * get(const Key &key) const
Return const pointer associated with given entry or a nullptr if the key does not exist in the table...
bool insert(const Key &, T *)=delete
No insert() with raw pointers (potential memory leaks). Use insert() with autoPtr or set() ...
auto key(const Type &t) -> typename std::enable_if< std::is_enum< Type >::value, typename std::underlying_type< Type >::type >::type
Pointer management similar to std::unique_ptr, with some additional methods and type checking...
T * ptr() const
Return managed pointer for reuse, or clone() the object reference.
A class for managing temporary objects.
Foam::argList args(argc, argv)