Add is_zero_constructible to denote if a type can be semi-trivially constructed with all 0 bytes.

Optimize `CowData` and `LocalVector` resize for zero constructible types.
Mark several compatible types as `is_zero_constructible`.
This commit is contained in:
Lukas Tenbrink
2025-03-07 13:16:32 +01:00
parent 78c9f8ddd9
commit 75bc471965
19 changed files with 93 additions and 11 deletions

View File

@@ -652,6 +652,10 @@ public:
}
};
// Zero-constructing String initializes _cowdata.ptr() to nullptr and thus empty.
template <>
struct is_zero_constructible<String> : std::true_type {};
bool operator==(const char *p_chr, const String &p_str);
bool operator==(const wchar_t *p_chr, const String &p_str);
bool operator!=(const char *p_chr, const String &p_str);