comparison include/core/strings.h @ 178:bc8d2ccff09c

win32/dark: use existing STL classes for dwmapi
author Paper <mrpapersonic@gmail.com>
date Mon, 04 Dec 2023 11:51:30 -0500
parents bc218c9d2ea6
children 7cf53145de11
comparison
equal deleted inserted replaced
177:122fad646f81 178:bc8d2ccff09c
51 if constexpr (std::is_signed<T>::value) { 51 if constexpr (std::is_signed<T>::value) {
52 return clamp(std::stoll(str), std::numeric_limits<T>::min(), std::numeric_limits<T>::max()); 52 return clamp(std::stoll(str), std::numeric_limits<T>::min(), std::numeric_limits<T>::max());
53 } else if constexpr (std::is_unsigned<T>::value) { 53 } else if constexpr (std::is_unsigned<T>::value) {
54 return clamp(std::stoull(str), std::numeric_limits<T>::max(), std::numeric_limits<T>::max()); 54 return clamp(std::stoull(str), std::numeric_limits<T>::max(), std::numeric_limits<T>::max());
55 } else { 55 } else {
56 throw std::invalid_argument("it no worky"); 56 throw std::invalid_argument("Invalid input to Strings::ToInt()!");
57 } 57 }
58 } catch (std::invalid_argument const& ex) { 58 } catch (std::invalid_argument const& ex) {
59 return def; 59 return def;
60 } 60 }
61 } 61 }