On Monday, 29 September 2014 at 20:21:43 UTC, gedaiu wrote:
Hi,
There is a way to determine all public properties (not methods)
from a struct/class at compile time?
I seen that there are traits to get only methods but not
properties. Am I wrong?
thanks,
Bogdan
You can get the function attributes of the returned methods using
std.traits:
http://dlang.org/library/std/traits/functionAttributes.html
http://dlang.org/library/std/traits/FunctionAttribute.html
Vibe's serializer is also a good place to look. The code is a bit
intimidating but it's handling a ton of corner cases:
https://github.com/rejectedsoftware/vibe.d/blob/master/source/vibe/data/serialization.d#L710