diff options
author | HampusM <hampus@hampusmat.com> | 2022-03-29 17:40:04 +0200 |
---|---|---|
committer | HampusM <hampus@hampusmat.com> | 2022-06-13 17:56:57 +0200 |
commit | a039c8ad36779903571419cb06cd052f8fc41512 (patch) | |
tree | 4fdced6941a048bdd4b032fab7012bca00a6028e /src/argument_parser.cpp | |
parent | acf72075ed32e5a679d49ffedc0c28d8ac2aea8b (diff) |
refactor: use trailing return types
Diffstat (limited to 'src/argument_parser.cpp')
-rw-r--r-- | src/argument_parser.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/argument_parser.cpp b/src/argument_parser.cpp index 94c6a4a..fd18bc7 100644 --- a/src/argument_parser.cpp +++ b/src/argument_parser.cpp @@ -19,9 +19,9 @@ void optarg_error(char arg, const std::string_view &error) noexcept /** * Returns the current optarg as a string view. */ -std::string_view get_str_optarg() noexcept +auto get_str_optarg() noexcept -> std::string_view { - return std::string_view(optarg); + return {optarg}; } /** @@ -30,7 +30,7 @@ std::string_view get_str_optarg() noexcept * @param arg The current command-line argument character * @param check_zero Whether or not to make sure that the result is not zero */ -uint32_t get_uint_optarg(char arg, bool check_zero = false) noexcept +auto get_uint_optarg(char arg, bool check_zero = false) noexcept -> uint32_t { auto conversion_result = str_to_uint(get_str_optarg()); @@ -49,10 +49,10 @@ ArgumentParser::ArgumentParser( { } -ParsedArguments ArgumentParser::parse( +auto ArgumentParser::parse( const std::vector<option> &options, const std::string_view &short_options, const int &argc, - char *const *argv) noexcept // NOLINT(cppcoreguidelines-avoid-c-arrays, + char *const *argv) noexcept -> ParsedArguments // NOLINT(cppcoreguidelines-avoid-c-arrays, // modernize-avoid-c-arrays) { // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic) |