ENH: rationalize some string methods.

- silently deprecate 'startsWith', 'endsWith' methods
  (added in 2016: 2b14360662), in favour of
  'starts_with', 'ends_with' methods, corresponding to C++20 and
  allowing us to cull then in a few years.

- handle single character versions of starts_with, ends_with.

- add single character version of removeEnd and silently deprecate
  removeTrailing which did the same thing.

- drop the const versions of removeRepeated, removeTrailing.
  Unused and with potential confusion.

STYLE: use shrink_to_fit(), erase()
This commit is contained in:
Mark Olesen
2019-11-11 18:50:00 +01:00
committed by Andrew Heather
parent ea214727a5
commit 7c1190f0b1
28 changed files with 185 additions and 206 deletions

View File

@ -256,7 +256,7 @@ bool Foam::functionObjects::vtkCloud::writeCloud
(
[](const word& k)
{
return k.startsWith("position") || k.startsWith("coordinate");
return k.starts_with("position") || k.starts_with("coordinate");
},
true // prune
);

View File

@ -226,7 +226,7 @@ bool Foam::functionObjects::ensightWrite::write()
// Prune restart fields
acceptField.filterKeys
(
[](const word& k){ return k.endsWith("_0"); },
[](const word& k){ return k.ends_with("_0"); },
true // prune
);

View File

@ -304,7 +304,7 @@ bool Foam::functionObjects::vtkWrite::write()
// Prune restart fields
acceptField.filterKeys
(
[](const word& k){ return k.endsWith("_0"); },
[](const word& k){ return k.ends_with("_0"); },
true // prune
);