Guest User

Untitled

a guest
Jun 24th, 2018
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. union {
  2. {
  3. Scalar x, y;
  4. }
  5. Scalar v[2];
  6. };
  7.  
  8. union {
  9. struct {
  10. int x;
  11. int y;
  12. };
  13. int v[2];
  14. };
  15.  
  16. union a {
  17. struct b { int first, second; } bee;
  18. int v[2];
  19. };
  20.  
  21. template<class T>
  22. struct U1
  23. {
  24. U1();
  25. T v[2];
  26. T& x;
  27. T& y;
  28. };
  29.  
  30. template<class T>
  31. U1<T>::U1()
  32. :x(v[0])
  33. ,y(v[1])
  34. {}
  35.  
  36. int main()
  37. {
  38. U1<int> data;
  39.  
  40. data.x = 1;
  41. data.y = 2;
  42. }
  43.  
  44. struct Vec2
  45. {
  46. float x;
  47. float y;
  48. float& operator[](int i) { return *(&x+i); }
  49. };
Add Comment
Please, Sign In to add comment