meta: also please toolset v141 :)

This commit is contained in:
Michele Caini
2021-09-03 18:55:51 +02:00
parent 591f885e67
commit fee48ab04c
2 changed files with 6 additions and 1 deletions
+1
View File
@@ -1511,6 +1511,7 @@ bool meta_any::set(const id_type id, Type &&value) {
// exploits the fact that arithmetic types and enums are also default constructible
auto other = type.construct();
const double value = node->conversion_helper(storage, nullptr);
ENTT_ASSERT(other.node->conversion_helper, "Conversion helper not found");
other.node->conversion_helper(other.storage, &value);
return other;
}
+5 -1
View File
@@ -150,10 +150,14 @@ class ENTT_API meta_node {
}
[[nodiscard]] static decltype(meta_type_node::conversion_helper) meta_conversion_helper() ENTT_NOEXCEPT {
if constexpr(std::is_arithmetic_v<Type> || std::is_enum_v<Type>) {
if constexpr(std::is_arithmetic_v<Type>) {
return +[](const any &storage, const double *value) {
return value ? static_cast<double>(any_cast<Type &>(const_cast<any &>(storage)) = static_cast<Type>(*value)) : static_cast<double>(any_cast<const Type &>(storage));
};
} else if constexpr(std::is_enum_v<Type>) {
return +[](const any &storage, const double *value) {
return value ? static_cast<double>(any_cast<Type &>(const_cast<any &>(storage)) = Type{static_cast<std::underlying_type_t<Type>>(*value)}) : static_cast<double>(any_cast<const Type &>(storage));
};
} else {
return nullptr;
}