mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-22 09:12:13 -05:00
AK: Remove default parameter from StringBuilder's constructor
This separates the StringBuilder constructor into 2 constructors. This essentially allows forming code of the following pattern: StringBuilder foo() { return {}; } Otherwise, we would get the following compiler error: chosen constructor is explicit in copy-initialization Due to the explicitness of the StringBuilder constructor. This is required for an upcoming update to ICU 76, where we use our StringBuilder in templated ICU code.
This commit is contained in:
parent
e5d521bef8
commit
c2741ea85e
Notes:
github-actions[bot]
2025-01-18 22:58:05 +00:00
Author: https://github.com/trflynn89 Commit: https://github.com/LadybirdBrowser/ladybird/commit/c2741ea85e2 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3295 Reviewed-by: https://github.com/shannonbooth ✅
2 changed files with 7 additions and 1 deletions
|
@ -40,6 +40,11 @@ ErrorOr<StringBuilder> StringBuilder::create(size_t initial_capacity)
|
||||||
return StringBuilder { move(buffer) };
|
return StringBuilder { move(buffer) };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
StringBuilder::StringBuilder()
|
||||||
|
: StringBuilder(inline_capacity)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
StringBuilder::StringBuilder(size_t initial_capacity)
|
StringBuilder::StringBuilder(size_t initial_capacity)
|
||||||
: m_buffer(MUST(create_buffer(initial_capacity)))
|
: m_buffer(MUST(create_buffer(initial_capacity)))
|
||||||
{
|
{
|
||||||
|
|
|
@ -23,7 +23,8 @@ public:
|
||||||
|
|
||||||
static ErrorOr<StringBuilder> create(size_t initial_capacity = inline_capacity);
|
static ErrorOr<StringBuilder> create(size_t initial_capacity = inline_capacity);
|
||||||
|
|
||||||
explicit StringBuilder(size_t initial_capacity = inline_capacity);
|
StringBuilder();
|
||||||
|
explicit StringBuilder(size_t initial_capacity);
|
||||||
~StringBuilder() = default;
|
~StringBuilder() = default;
|
||||||
|
|
||||||
ErrorOr<void> try_append(StringView);
|
ErrorOr<void> try_append(StringView);
|
||||||
|
|
Loading…
Reference in a new issue