C++反射模板库 Template Reflection Library
fmms 13年前
trl 是一个用于serialize/deserialize,object hierarchy的C++库,依赖于标准 standard C++预处理宏和模板元编程技术。 <br /> <pre class="brush:cpp; toolbar: true; auto-links: false;">class SimpleClass { TRL_BEGIN_MEMBERS(SimpleClass) TRL_MEMBER(private, int, m_count) TRL_MEMBER(private, std::string, m_name) TRL_END_MEMBERS() }; </pre> <pre class="brush:cpp; toolbar: true; auto-links: false;">int main(void) { SimpleClass obj; long length = 0; char* data = trl::serialize(obj, length); SimpleClass* ptr = trl::deserialize<SimpleClass>(data); } </pre> <br /> 项目地址: <a href="/misc/goto?guid=4958190414657956692" target="_blank">http://trl.sourceforge.net/</a>