Advertisement
Guest User

Untitled

a guest
Jun 19th, 2019
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.30 KB | None | 0 0
  1. #include "refl.hpp"
  2.  
  3. struct Point {
  4. float x, y;
  5. };
  6.  
  7. REFL_TYPE(Point)
  8. REFL_FIELD(x)
  9. REFL_FIELD(y)
  10. REFL_END
  11.  
  12. int main() {
  13. Point pt{ 0.f, 5.f };
  14. for_each(refl::reflect(pt).members, [&](auto member) {
  15. std::cout << member.name << " = " << member(pt) << ";";
  16. });
  17. /// Prints
  18. /// x=0;y=0.5;
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement