aboutsummaryrefslogtreecommitdiff
path: root/src/conversion.cpp
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2022-02-18 18:40:37 +0100
committerHampusM <hampus@hampusmat.com>2022-02-18 18:40:37 +0100
commit3e4d91b6b029374813cfd0900db1fa8984ad7aa3 (patch)
treee28fab22cc251047f5f20c7d1e1bf59a4cf5339e /src/conversion.cpp
parentd5612756b98afa43443a210722691c2e07ddfd5c (diff)
refactor: use string_view & improve argument parsing
Diffstat (limited to 'src/conversion.cpp')
-rw-r--r--src/conversion.cpp4
1 files changed, 2 insertions, 2 deletions
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 <climits>
#include <stdexcept>
-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)
{