ENH: additional PtrList constructor and memory management method

- PtrList::release() method.

  Similar to autoPtr and unique_ptr and clearer in purpose than
  using set(i,nullptr)

- Construct from List of pointers, taking ownership.

  Useful when upgrading code. Eg,

     List<polyPatch*> oldList = ...;
     PtrList<polyPatch> newList(oldList);
     ...

BUG: incorrect resizing method names (PtrDynList) in previously unused code
This commit is contained in:
Mark Olesen
2019-02-22 15:55:17 +01:00
committed by Andrew Heather
parent 683817bcab
commit 7795adfcb4
8 changed files with 161 additions and 21 deletions

View File

@ -103,7 +103,7 @@ Foam::autoPtr<Foam::functionObject> Foam::functionObjectList::remove
oldIndex = *iter;
// Remove pointer from the old list
oldptr = this->set(oldIndex, nullptr);
oldptr = this->release(oldIndex);
indices_.erase(iter);
}
else