STYLE: add const_cast when deleting pointers in objectRegistry

- makes the intention clearer, allows for future tightening of
  iterator access rules.
This commit is contained in:
Mark Olesen
2019-09-25 13:30:25 +02:00
committed by Andrew Heather
parent a1ee14690b
commit 2259fd845c

View File

@ -370,7 +370,7 @@ bool Foam::objectRegistry::erase(const iterator& iter)
if (iter.found())
{
regIOobject* ptr = iter.val();
regIOobject* ptr = const_cast<iterator&>(iter).val();
const bool ok = HashTable<regIOobject*>::erase(iter);
@ -395,7 +395,7 @@ bool Foam::objectRegistry::erase(const word& key)
Foam::label Foam::objectRegistry::erase(std::initializer_list<word> keys)
{
return eraseImpl(*this, keys.begin(), keys.end());
return eraseImpl(*this, keys.begin(), keys.end());
}