Util: Use C++20 designated initializer lists on structs
This commit is contained in:
@@ -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;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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 });
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user