Advertisement
Guest User

Untitled

a guest
Jun 27th, 2015
385
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.40 KB | None | 0 0
  1. class Time {
  2.   public:
  3.   float value;
  4.  
  5.   Time(float f):value{f}{}
  6.   Time operator +(Time b) const
  7.   { return value + b.value; }
  8.   operator float() const
  9.   { return value; }
  10. };
  11.  
  12. float f(float a, float b)
  13. { return a + b; }
  14.  
  15. float g(Time a, Time b)
  16. { return a + b; }
  17.  
  18.  
  19. Result: (with gcc.godbolt.org)
  20. f(float, float):
  21.     addss   %xmm1, %xmm0
  22.     ret
  23. g(Time, Time):
  24.     addss   %xmm1, %xmm0
  25.     ret
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement