From 3e4d91b6b029374813cfd0900db1fa8984ad7aa3 Mon Sep 17 00:00:00 2001 From: HampusM Date: Fri, 18 Feb 2022 18:40:37 +0100 Subject: refactor: use string_view & improve argument parsing --- src/conversion.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/conversion.cpp') diff --git a/src/conversion.cpp b/src/conversion.cpp index b8fb942..71ba1b2 100644 --- a/src/conversion.cpp +++ b/src/conversion.cpp @@ -3,7 +3,7 @@ #include #include -unsigned int str_to_uint(std::string str) +unsigned int str_to_uint(std::string_view str) { if (str.at(0) == '-') { @@ -16,7 +16,7 @@ unsigned int str_to_uint(std::string str) try { - num = std::stoul(str, &waste_pos, NUMBER_BASE); + num = std::stoul(str.data(), &waste_pos, NUMBER_BASE); } catch (const std::invalid_argument &exc) { -- cgit v1.2.3-18-g5258