mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 20:27:34 +00:00
Everywhere: Use to_number<T> instead of to_{int,uint,float,double}
In a bunch of cases, this actually ends up simplifying the code as to_number will handle something such as: ``` Optional<I> opt; if constexpr (IsSigned<I>) opt = view.to_int<I>(); else opt = view.to_uint<I>(); ``` For us. The main goal here however is to have a single generic number conversion API between all of the String classes.
This commit is contained in:
parent
a4ecc65398
commit
e2e7c4d574
155 changed files with 397 additions and 412 deletions
|
@ -179,7 +179,7 @@ static void parse_args(Main::Arguments arguments, TopOption& top_option)
|
|||
.short_name = 'p',
|
||||
.accept_value = [&pids](auto comma_separated_pids) {
|
||||
for (auto pid : comma_separated_pids.split_view(',')) {
|
||||
auto maybe_integer = pid.to_int();
|
||||
auto maybe_integer = pid.template to_number<pid_t>();
|
||||
if (!maybe_integer.has_value())
|
||||
return false;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue