Util: Use C++20 designated initializer lists on structs

This commit is contained in:
Riyyi
2022-08-05 00:48:21 +02:00
parent 6c6ddf936a
commit 1fda63ae78
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -46,7 +46,7 @@ void Formatter<const char*>::parse(Parser& parser)
void Formatter<const char*>::format(Builder& builder, const char* value) const void Formatter<const char*>::format(Builder& builder, const char* value) const
{ {
if (specifier.type == PresentationType::Pointer) { if (specifier.type == PresentationType::Pointer) {
Formatter<const void*> formatter { specifier }; Formatter<const void*> formatter { .specifier = specifier };
formatter.format(builder, static_cast<const void*>(value)); formatter.format(builder, static_cast<const void*>(value));
return; return;
} }
+1 -1
View File
@@ -95,7 +95,7 @@ struct Formatter<T> {
if (specifier.type == PresentationType::Character) { if (specifier.type == PresentationType::Character) {
assert(value >= 0 && value <= 127); assert(value >= 0 && value <= 127);
Formatter<std::string_view> formatter { specifier }; Formatter<std::string_view> formatter { .specifier = specifier };
formatter.specifier.type = PresentationType::String; formatter.specifier.type = PresentationType::String;
return formatter.format(builder, { reinterpret_cast<const char*>(&value), 1 }); return formatter.format(builder, { reinterpret_cast<const char*>(&value), 1 });
} }