On Thursday, 12 May 2016 at 21:01:06 UTC, Adam D. Ruppe wrote:

foreach(member; __traits(allMembers, YourStruct))
  if(member in yourhash)
__traits(getMember, your_object, member) = to!right_type(yourhash[member]);


basically, it is a bit more complex to filter out inappropriate fields and such, but that's the idea.

Check out the sample chapter of my book https://www.packtpub.com/application-development/d-cookbook to see more, you can get the reflection chapter free on that site.

That's wonderful Adam, thank you! I actually had your book previously bookmarked - I should probably buy it :-)

Reply via email to