Age | Commit message (Collapse) | Author |
|
Switch the comparisons from "other == *this" to "*this == other".
|
|
|
|
Get rid of the weird old signature:
- int StringType::to_int(bool& ok) const
And replace it with sensible new signature:
- Optional<int> StringType::to_int() const
|
|
Also, make the zero-argument variant private since it's not meant to be
called by clients directly.
|
|
StringUtils::ends_with
This creates a unified implementation of ends_with with case sensitivity
across String/StringView/FlyString.
|
|
This allows you to compare a string against an arbitrary number of
other strings with a single call.
|
|
We're now clever enough to notice when we're constructing a FlyString
from a String that is actually already a FlyString. :^)
|
|
It's tedious to write (and look at) [[gnu::always_inline]] etc. :^)
|
|
|
|
Since the FlyString deduplication mechanism uses a HashTable, we know
that any StringImpl inside a non-null FlyString will already have its
lazily computed hash.
|
|
|
|
Some of these are very inefficient. It's nice to have some optimization
opportunities in the future though. :^)
|
|
|
|
String.h no longer pulls in StringView.h. We do this by moving a bunch
of String functions out-of-line.
|
|
|
|
And share the code with String by moving the logic to StringUtils. :^)
|
|
FlyString is a flyweight string class that wraps a RefPtr<StringImpl>
known to be unique among the set of FlyStrings. The class is very
unoptimized at the moment.
When to use FlyString:
- When you want O(1) string comparison
- When you want to deduplicate a lot of identical strings
When not to use FlyString:
- For strings that don't need either of the above features
- For strings that are likely to be unique
|