meta: relaxed checks on conversion functions
This commit is contained in:
@@ -269,12 +269,9 @@ public:
|
||||
*/
|
||||
template<auto Candidate>
|
||||
auto conv() ENTT_NOEXCEPT {
|
||||
using conv_type = std::remove_const_t<std::remove_reference_t<std::invoke_result_t<decltype(Candidate), Type &>>>;
|
||||
static_assert(!std::is_same_v<Type, conv_type> && std::is_convertible_v<Type, conv_type>, "Could not convert to the required type");
|
||||
|
||||
static internal::meta_conv_node node{
|
||||
nullptr,
|
||||
internal::meta_node<conv_type>::resolve(),
|
||||
internal::meta_node<std::remove_const_t<std::remove_reference_t<std::invoke_result_t<decltype(Candidate), Type &>>>>::resolve(),
|
||||
[](const meta_any &instance) -> meta_any {
|
||||
return forward_as_meta(std::invoke(Candidate, *static_cast<const Type *>(instance.data())));
|
||||
}
|
||||
@@ -296,12 +293,9 @@ public:
|
||||
*/
|
||||
template<typename To>
|
||||
auto conv() ENTT_NOEXCEPT {
|
||||
using conv_type = std::remove_const_t<std::remove_reference_t<To>>;
|
||||
static_assert(!std::is_same_v<Type, conv_type> && std::is_convertible_v<Type, conv_type>, "Could not convert to the required type");
|
||||
|
||||
static internal::meta_conv_node node{
|
||||
nullptr,
|
||||
internal::meta_node<conv_type>::resolve(),
|
||||
internal::meta_node<std::remove_const_t<std::remove_reference_t<To>>>::resolve(),
|
||||
[](const meta_any &instance) -> meta_any { return forward_as_meta(static_cast<To>(*static_cast<const Type *>(instance.data()))); }
|
||||
// tricks clang-format
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user