We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
template<typename callback_t, typename ...A> static typename std::result_of<callback_t(A...)>::type invoke(void* target, int cid, A&& ... args) { auto x = dynamic_cast<internal::callback_object<callback_t>*>(reinterpret_cast<callbacks*>(target)->m_lut[cid].get()); assert(x); return x->invoke(std::forward<A>(args)...); }
it would be better to use a boost::polymorphic_downcast, or if you don't want the dependency on boost, add a helper function:
boost::polymorphic_downcast
template <class Target, class Source> inline Target polymorphic_downcast(Source* x) { assert(dynamic_cast<Target>(x) == x); return static_cast<Target>(x); } template<typename callback_t, typename ...A> static typename std::result_of<callback_t(A...)>::type invoke(void* target, int cid, A&& ... args) { auto x = polymorphic_downcast<internal::callback_object<callback_t>*>(reinterpret_cast<callbacks*>(target)->m_lut[cid].get()); return x->invoke(std::forward<A>(args)...); }
The text was updated successfully, but these errors were encountered:
Agreed, feel free to send a pull request.
Sorry, something went wrong.
No branches or pull requests
it would be better to use a
boost::polymorphic_downcast
, or if you don't want the dependency on boost, add a helper function:The text was updated successfully, but these errors were encountered: