Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- union {
- {
- Scalar x, y;
- }
- Scalar v[2];
- };
- union {
- struct {
- int x;
- int y;
- };
- int v[2];
- };
- union a {
- struct b { int first, second; } bee;
- int v[2];
- };
- template<class T>
- struct U1
- {
- U1();
- T v[2];
- T& x;
- T& y;
- };
- template<class T>
- U1<T>::U1()
- :x(v[0])
- ,y(v[1])
- {}
- int main()
- {
- U1<int> data;
- data.x = 1;
- data.y = 2;
- }
- struct Vec2
- {
- float x;
- float y;
- float& operator[](int i) { return *(&x+i); }
- };
Add Comment
Please, Sign In to add comment