Advertisement
Guest User

Untitled

a guest
Nov 25th, 2014
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. typedef void (*fptr)(void);
  2. struct Mystruct
  3. {
  4. int id;
  5. int priority;
  6. double timeSaved;
  7. double aktivationTime;
  8. fptr eventPointer;
  9. MystructnextPtr;
  10.  
  11. Mystruct(int id, int priority, double timeSaved, double aktivationTime, fptr eventPointer);
  12. };
  13.  
  14. bool operator <(const Mystruct& x, const Mystruct& y)
  15. {
  16. return std::tie(x.aktivationTime, x.priority, x.timeSaved) < std::tie(y.aktivationTime, y.priority, y.timeSaved);
  17. }
  18.  
  19. Mystruct* struct1 = new Mystruct(5, 10, 0, 15.3, f1);
  20. Mystruct* struct2 = new Mystruct(5, 10, 0, 14.3, fi);
  21.  
  22. if (struct1 < struct2)
  23. {
  24. cout << "struct1 is smaller!" << endl;
  25. }
  26. else
  27. {
  28. cout << "struct2 is smaller!" << endl;
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement