Advertisement
Guest User

Untitled

a guest
Sep 20th, 2017
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. struct s77 {
  2. char d[77];
  3. };
  4.  
  5. struct s1 {
  6. char d;
  7. };
  8.  
  9. struct Foo: s77, s1 {
  10. };
  11.  
  12. struct Off {
  13. static const int v = std::size_t(static_cast<s1*>(static_cast<Foo*>(nullptr)+1)) - std::size_t(static_cast<Foo*>(nullptr)+1);
  14. };
  15.  
  16. struct Entry {
  17. int offset;
  18. void (*function)(void *member);
  19. };
  20.  
  21. Entry descriptor[] = {
  22. { 0, &SomeType1::static_function },
  23. { 12, &SomeType2::static_function },
  24. { 20, &SomeType3::static_function }
  25. };
  26.  
  27. void call(void *tuple, const Entry *entries, int n) {
  28. for (int i=0; i<n; i++) {
  29. entries[i].function(static_cast<char *>(tuple)+entries[i].offset);
  30. }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement