From dc6222611ad14a33f642396558ba84ecba9d6605 Mon Sep 17 00:00:00 2001 From: HampusM Date: Mon, 14 Mar 2022 18:02:18 +0100 Subject: perf: add noexcept almost everywhere --- src/argument_parser.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'src/argument_parser.cpp') diff --git a/src/argument_parser.cpp b/src/argument_parser.cpp index 16945f7..94c6a4a 100644 --- a/src/argument_parser.cpp +++ b/src/argument_parser.cpp @@ -9,7 +9,7 @@ namespace { -void optarg_error(char arg, const std::string_view &error) +void optarg_error(char arg, const std::string_view &error) noexcept { std::cout << "Error: Invalid option argument for -" << arg << ". " << error << std::endl; @@ -19,7 +19,7 @@ void optarg_error(char arg, const std::string_view &error) /** * Returns the current optarg as a string view. */ -std::string_view get_str_optarg() +std::string_view get_str_optarg() noexcept { return std::string_view(optarg); } @@ -30,7 +30,7 @@ std::string_view get_str_optarg() * @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) +uint32_t get_uint_optarg(char arg, bool check_zero = false) noexcept { auto conversion_result = str_to_uint(get_str_optarg()); @@ -44,16 +44,16 @@ uint32_t get_uint_optarg(char arg, bool check_zero = false) } // namespace ArgumentParser::ArgumentParser( - IRandomNumberGeneratorFactory random_number_generator_factory) + IRandomNumberGeneratorFactory random_number_generator_factory) noexcept : _random_number_generator_factory(random_number_generator_factory) { } -ParsedArguments -ArgumentParser::parse(const std::vector