[cfe-dev] Get member offset in a non-POD type

Aleksei Sidorin a.sidorin at samsung.com
Wed Mar 25 10:29:49 PDT 2015


Hello Vlad,

Take a look on ASTRecordLayout class. It may solve some of your problems.
As I understand, you can also take a look on some existing solutions 
(Boost::serialization, protobuf).

> Hi! I need to implement reflection for my C++ project. I was thinking about
> something like offsetof() to get offset of a class member, but offsetof()
> is applicable just for POD types. So, I have a question: is it possible to
> implement Clang plugin(or tool) to generate metadata(like offsets, names,
> types, ...) needed for reflection?


-- 
Best regards,
Aleksei Sidorin
Software Engineer,
IMSWL-IMCG, SRR, Samsung Electronics




More information about the cfe-dev mailing list