mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 14:38:11 +00:00
AK: Make string-to-number conversion helpers return Optional
Get rid of the weird old signature: - int StringType::to_int(bool& ok) const And replace it with sensible new signature: - Optional<int> StringType::to_int() const
This commit is contained in:
parent
15f4043a7a
commit
fdfda6dec2
55 changed files with 354 additions and 455 deletions
|
@ -75,12 +75,12 @@ int main(int argc, char** argv)
|
|||
break;
|
||||
}
|
||||
|
||||
bool ok;
|
||||
size = str.to_int(ok);
|
||||
if (!ok) {
|
||||
auto size_opt = str.to_int();
|
||||
if (!size_opt.has_value()) {
|
||||
args_parser.print_usage(stderr, argv[0]);
|
||||
return 1;
|
||||
}
|
||||
size = size_opt.value();
|
||||
}
|
||||
|
||||
if (reference) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue