mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-20 18:22:07 +00:00
Use std::string for string-formatted values (#1360)
* Use `std::string` for string-formatted values * Make `formatString` and `formatNumber` be `const`
This commit is contained in:
@@ -2690,15 +2690,13 @@ static std::string strfmt(
|
||||
// Will warn after formatting is done.
|
||||
str += '%';
|
||||
} else {
|
||||
static char buf[MAXSTRLEN + 1];
|
||||
std::visit(
|
||||
str.append(std::visit(
|
||||
Visitor{
|
||||
[&](uint32_t n) { fmt.printNumber(buf, sizeof(buf), n); },
|
||||
[&](std::string const &s) { fmt.printString(buf, sizeof(buf), s.c_str()); },
|
||||
[&fmt](uint32_t n) { return fmt.formatNumber(n); },
|
||||
[&fmt](std::string const &s) { return fmt.formatString(s); },
|
||||
},
|
||||
args[argIndex]
|
||||
);
|
||||
str.append(buf);
|
||||
));
|
||||
}
|
||||
|
||||
argIndex++;
|
||||
|
||||
Reference in New Issue
Block a user