|
|
|
|
|
by secondcoming
2021 days ago
|
|
Just yesterday I had to wrap up offsetof in a macro for use in some pseudo-reflection code #define MEMBER(C, M) { offsetof(C, M), sizeof(C::M) }
I couldn't figure out nice a way to do this without the preprocessor. The best I came up with was to use a lambda: [] (const C& c) { return std::cref(c.m); }
But these are stored in a std::map which means I have to use function pointers or accept the overhead of std::function |
|