*: minor changes

This commit is contained in:
Michele Caini
2021-01-08 11:43:26 +01:00
parent 375c780d3b
commit 8cb61da9c2
4 changed files with 6 additions and 6 deletions

View File

@@ -85,7 +85,7 @@ class poly_vtable {
};
} else {
entry = +[](Any &any, Args... args) -> Ret {
return std::invoke(Candidate, any_cast<constness_as_t<Type, Any> &>(any), std::forward<Args>(args)...);
return static_cast<Ret>(std::invoke(Candidate, any_cast<constness_as_t<Type, Any> &>(any), std::forward<Args>(args)...));
};
}
}

View File

@@ -100,7 +100,7 @@ class delegate<Ret(Args...)> {
[[nodiscard]] auto wrap(std::index_sequence<Index...>) ENTT_NOEXCEPT {
return [](const void *, Args... args) -> Ret {
[[maybe_unused]] const auto arguments = std::forward_as_tuple(std::forward<Args>(args)...);
return Ret(std::invoke(Candidate, std::forward<type_list_element_t<Index, type_list<Args...>>>(std::get<Index>(arguments))...));
return static_cast<Ret>(std::invoke(Candidate, std::forward<type_list_element_t<Index, type_list<Args...>>>(std::get<Index>(arguments))...));
};
}
@@ -109,7 +109,7 @@ class delegate<Ret(Args...)> {
return [](const void *payload, Args... args) -> Ret {
[[maybe_unused]] const auto arguments = std::forward_as_tuple(std::forward<Args>(args)...);
Type *curr = static_cast<Type *>(const_cast<constness_as_t<void, Type> *>(payload));
return Ret(std::invoke(Candidate, *curr, std::forward<type_list_element_t<Index, type_list<Args...>>>(std::get<Index>(arguments))...));
return static_cast<Ret>(std::invoke(Candidate, *curr, std::forward<type_list_element_t<Index, type_list<Args...>>>(std::get<Index>(arguments))...));
};
}
@@ -118,7 +118,7 @@ class delegate<Ret(Args...)> {
return [](const void *payload, Args... args) -> Ret {
[[maybe_unused]] const auto arguments = std::forward_as_tuple(std::forward<Args>(args)...);
Type *curr = static_cast<Type *>(const_cast<constness_as_t<void, Type> *>(payload));
return Ret(std::invoke(Candidate, curr, std::forward<type_list_element_t<Index, type_list<Args...>>>(std::get<Index>(arguments))...));
return static_cast<Ret>(std::invoke(Candidate, curr, std::forward<type_list_element_t<Index, type_list<Args...>>>(std::get<Index>(arguments))...));
};
}

View File

@@ -68,7 +68,7 @@ struct overloaded_func_t {
float f(int a, float b) {
value = a;
return e(b);
return static_cast<float>(e(static_cast<int>(b)));
}
int g(int v) const {

View File

@@ -11,7 +11,7 @@ struct Deduced: entt::type_list<> {
void set(int v) { entt::poly_call<1>(*this, v); }
int get() const { return entt::poly_call<2>(*this); }
void decr() { entt::poly_call<3>(*this); }
int mul(int v) const { return entt::poly_call<4>(*this, v); }
int mul(int v) const { return static_cast<int>(entt::poly_call<4>(*this, v)); }
};
template<typename Type>