Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Auto stash before checking out "origin/feature/gjk_algorithm"
  • Loading branch information
orange-cpp committed Nov 9, 2025
commit c4024663bbd5dbb0d788df03883523ea55e71916
17 changes: 8 additions & 9 deletions include/omath/rev_eng/internal_rev_object.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,27 +23,26 @@ namespace omath::rev_eng
return *reinterpret_cast<Type*>(reinterpret_cast<std::uintptr_t>(this) + offset);
}

template<std::size_t id, class ReturnType, class... Args>
ReturnType call_virtual_method(Args&&... arg_list)
template<std::size_t id, class ReturnType>
ReturnType call_virtual_method(auto... arg_list)
{
#ifdef _MSC_VER
using VirtualMethodType = ReturnType(__thiscall*)(void*, decltype(arg_list)...);
#else
using VirtualMethodType = ReturnType (*)(void*, decltype(arg_list)...);
#endif
return (*reinterpret_cast<VirtualMethodType**>(this))[id](this, std::forward<Args>(arg_list)...);
return (*reinterpret_cast<VirtualMethodType**>(this))[id](this, arg_list...);
}
template<std::size_t id, class ReturnType, class... Args>
ReturnType call_virtual_method(Args&&... arg_list) const
template<std::size_t id, class ReturnType>
ReturnType call_virtual_method(auto... arg_list) const
{
using This = std::remove_cv_t<std::remove_pointer_t<decltype(this)>>;
#ifdef _MSC_VER
using VirtualMethodType = ReturnType(__thiscall*)(const void*, decltype(arg_list)...);
using VirtualMethodType = ReturnType(__thiscall*)(void*, decltype(arg_list)...);
#else
using VirtualMethodType = ReturnType (*)(void*, decltype(arg_list)...);
#endif
return (*reinterpret_cast<VirtualMethodType**>(const_cast<This*>(this)))[id](
const_cast<void*>(static_cast<const void*>(this)), std::forward<Args>(arg_list)...);
return (*static_cast<VirtualMethodType**>((void*)(this)))[id](
const_cast<void*>(static_cast<const void*>(this)), arg_list...);
}
};
} // namespace omath::rev_eng
Loading