int_conv can be constexpr sometimes
This commit is contained in:
parent
1f44e74465
commit
b52343014b
1 changed files with 2 additions and 2 deletions
|
@ -43,14 +43,14 @@ namespace dhandy {
|
||||||
};
|
};
|
||||||
template <typename T>
|
template <typename T>
|
||||||
struct IntConv<T, std::enable_if_t<std::is_integral_v<T>, std::string_view>> {
|
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());
|
return dhandy::ary_to_int<T>(in.data(), in.data() + in.size());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
} //namespace implem
|
} //namespace implem
|
||||||
|
|
||||||
template <typename To, typename From>
|
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);
|
return implem::IntConv<To, From>::conv(from);
|
||||||
}
|
}
|
||||||
} //namespace dhandy
|
} //namespace dhandy
|
||||||
|
|
Loading…
Add table
Reference in a new issue