Age | Commit message (Collapse) | Author |
|
|
|
|
|
This behavior might not always be desirable, and so this patch adds a
way to disable it.
|
|
This allows you to create a FlyString directly from a known-fly
StringImpl instance.
|
|
This reverts commit f09216ac42bac9108e7f36ed2938c6f278f497e4.
This was supposed to be a local test only, didn't mean to push it. :^)
|
|
This reverts commit 66f15c2e0c34caed8ce56075a366b20c4d1819af.
|
|
|
|
Previously this was generating a crazy number of symbols, and it was
also pretty-damn-slow as it was defined recursively, which made the
compiler incapable of inlining it (due to the many many layers of
recursion before it terminated).
This commit replaces the recursion with a pack expansion and marks it
always-inline.
|
|
|
|
SPDX License Identifiers are a more compact / standardized
way of representing file license information.
See: https://spdx.dev/resources/use/#identifiers
This was done with the `ambr` search and replace tool.
ambr --no-parent-ignore --key-from-file --rep-from-file key.txt rep.txt *
|
|
Problem:
- Many constructors are defined as `{}` rather than using the ` =
default` compiler-provided constructor.
- Some types provide an implicit conversion operator from `nullptr_t`
instead of requiring the caller to default construct. This violates
the C++ Core Guidelines suggestion to declare single-argument
constructors explicit
(https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#c46-by-default-declare-single-argument-constructors-explicit).
Solution:
- Change default constructors to use the compiler-provided default
constructor.
- Remove implicit conversion operators from `nullptr_t` and change
usage to enforce type consistency without conversion.
|
|
|
|
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
|