diff options
author | Moustafa Raafat <MoustafaRaafat2@gmail.com> | 2022-11-14 18:20:59 +0000 |
---|---|---|
committer | Sam Atkins <atkinssj@gmail.com> | 2022-12-09 11:25:30 +0000 |
commit | ae2abcebbbabf7ca8b806b5555c11cd0b216dbdb (patch) | |
tree | cef5406660d2e60fedda9dcd0839c8f88e0a2d93 /Userland/Libraries/LibCore/ArgsParser.cpp | |
parent | 9721da2e6ae2948319ae731b65073d1fe7200b4f (diff) | |
download | serenity-ae2abcebbbabf7ca8b806b5555c11cd0b216dbdb.zip |
Everywhere: Use C++ concepts instead of requires clauses
Diffstat (limited to 'Userland/Libraries/LibCore/ArgsParser.cpp')
-rw-r--r-- | Userland/Libraries/LibCore/ArgsParser.cpp | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/Userland/Libraries/LibCore/ArgsParser.cpp b/Userland/Libraries/LibCore/ArgsParser.cpp index 72d226c579..2d145b365c 100644 --- a/Userland/Libraries/LibCore/ArgsParser.cpp +++ b/Userland/Libraries/LibCore/ArgsParser.cpp @@ -460,9 +460,8 @@ void ArgsParser::add_option(StringView& value, char const* help_string, char con add_option(move(option)); } -template<typename Integral> -void ArgsParser::add_option(Integral& value, char const* help_string, char const* long_name, char short_name, char const* value_name, OptionHideMode hide_mode) -requires(IsIntegral<Integral>) +template<Integral I> +void ArgsParser::add_option(I& value, char const* help_string, char const* long_name, char short_name, char const* value_name, OptionHideMode hide_mode) { Option option { OptionArgumentMode::Required, @@ -472,11 +471,11 @@ requires(IsIntegral<Integral>) value_name, [&value](char const* s) { auto view = StringView { s, strlen(s) }; - Optional<Integral> opt; - if constexpr (IsSigned<Integral>) - opt = view.to_int<Integral>(); + Optional<I> opt; + if constexpr (IsSigned<I>) + opt = view.to_int<I>(); else - opt = view.to_uint<Integral>(); + opt = view.to_uint<I>(); value = opt.value_or(0); return opt.has_value(); }, |