Closed heketang closed 7 years ago
thinks ,i have do the work.
standard protobufs have a reflection API (https://developers.google.com/protocol-buffers/docs/reference/cpp/google.protobuf.message) but thanks to dproto using compile time generation and CTFE, can't we use D's builtin functionality for this?
eg:
foreach(memberName; __traits(allMembers, YourClass)) {...}
would that work?
Indeed, using D's builtin compile time reflection is the preferable way to do this, in order to stay as idiomatic to D as possible.
@msoucy @timotheecour , Thanks, the reflection of dlang is so strong.
example: message ms; auto names = ms.arr_names; foreach(name;names) { auto value =ms.name;
}