C++: Add clear() method to SharedString (#8797)

A convenience method to reset to an empty string, like already known
from std::string.

ChangeLog: [C++] Added `SharedString::clear()`
This commit is contained in:
U. Bruhin 2025-06-27 13:44:37 +02:00 committed by GitHub
parent 9a1ccaf502
commit 68b46276af
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 11 additions and 0 deletions

View file

@ -116,6 +116,9 @@ struct SharedString
== 0;
}
/// Reset to an empty string
void clear() { *this = std::string_view("", 0); }
/// Creates a new SharedString from the given number \a n. The string representation of the
/// number uses a minimal formatting scheme: If \a n has no fractional part, the number will be
/// formatted as an integer.