1
0
mirror of https://github.com/narzoul/DDrawCompat synced 2024-12-30 08:55:36 +01:00
DDrawCompat/DDrawCompat/Common/VtableSizeVisitor.h
2021-03-16 14:13:20 +01:00

23 lines
383 B
C++

#pragma once
template <typename Vtable>
class VtableSizeVisitor
{
public:
VtableSizeVisitor() : m_size(0)
{
}
unsigned getSize() const { return m_size; };
template <auto memberPtr>
void visit(const char* /*funcName*/)
{
Vtable* vtable = nullptr;
m_size = reinterpret_cast<unsigned>(&(vtable->*memberPtr)) + sizeof(vtable->*memberPtr);
}
private:
unsigned m_size;
};