Browse Source

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

master
Riyyi 2 years ago
parent
commit
1fda63ae78
  1. 2
      src/util/format/formatter.cpp
  2. 2
      src/util/format/formatter.h

2
src/util/format/formatter.cpp

@ -46,7 +46,7 @@ void Formatter<const char*>::parse(Parser& parser)
void Formatter<const char*>::format(Builder& builder, const char* value) const
{
if (specifier.type == PresentationType::Pointer) {
Formatter<const void*> formatter { specifier };
Formatter<const void*> formatter { .specifier = specifier };
formatter.format(builder, static_cast<const void*>(value));
return;
}

2
src/util/format/formatter.h

@ -95,7 +95,7 @@ struct Formatter<T> {
if (specifier.type == PresentationType::Character) {
assert(value >= 0 && value <= 127);
Formatter<std::string_view> formatter { specifier };
Formatter<std::string_view> formatter { .specifier = specifier };
formatter.specifier.type = PresentationType::String;
return formatter.format(builder, { reinterpret_cast<const char*>(&value), 1 });
}

Loading…
Cancel
Save