Replace value() with *operator && increase code legibility

shihan.42_7113-move-from-std-atoi-to-std-from_char
Shihan42 1 year ago
parent 803f15b20f
commit 31add3b3cc

@ -576,10 +576,11 @@ namespace MWScript
return;
}
long key = 0;
long key;
if (const auto k = ::Misc::StringUtils::toNumeric<long>(effect.data()); k.value() >= 0 && k.value() <= 32767)
key = k.value();
if (const auto k = ::Misc::StringUtils::toNumeric<long>(effect.data());
k.has_value() && *k >= 0 && *k <= 32767)
key = *k;
else
key = ESM::MagicEffect::effectStringToId({ effect });

@ -63,9 +63,9 @@ namespace Misc::StringUtils
template <typename T>
inline T toNumeric(std::string_view s, T defaultValue)
{
if (auto conversion = toNumeric<T>(s) ; conversion)
if (auto numeric = toNumeric<T>(s))
{
return conversion.value();
return *numeric;
}
return defaultValue;

Loading…
Cancel
Save