ENH: return plain List instead of shrinking the DynamicList

Using 'return List<T>(std::move(dynList))' for transfer of content
  (with implicit shrinking) into a plain List, and leave copy elision
  to do the rest. The implicit transfer (move construct List from
  DynamicList) will normally invoke resize (new/delete and moving
  elements).

  With 'return dynList.shrink()', it will first invoke an internal
  resize (new/delete and moving elements), followed by a copy
  construct as a plain list.

STYLE: avoid implicit cast to 'const List&' in constructors
This commit is contained in:
Mark Olesen
2025-04-08 09:20:57 +02:00
parent f13a05375c
commit 7f062a8f5e
25 changed files with 60 additions and 56 deletions

View File

@ -78,7 +78,7 @@ Foam::labelList Foam::functionObjects::vtkWrite::getSelectedPatches
}
}
return patchIDs.shrink();
return labelList(std::move(patchIDs));
}