int_conv can be constexpr sometimes

This commit is contained in:
King_DuckZ 2021-04-22 13:57:57 +02:00
parent 1f44e74465
commit b52343014b

View file

@ -43,14 +43,14 @@ namespace dhandy {
};
template <typename T>
struct IntConv<T, std::enable_if_t<std::is_integral_v<T>, std::string_view>> {
static T conv (const std::string_view& in) {
constexpr static T conv (const std::string_view& in) {
return dhandy::ary_to_int<T>(in.data(), in.data() + in.size());
}
};
} //namespace implem
template <typename To, typename From>
inline To int_conv (const From& from) {
constexpr inline To int_conv (const From& from) {
return implem::IntConv<To, From>::conv(from);
}
} //namespace dhandy