Changeset 1209
 Timestamp:
 Apr 10, 2012, 3:12:59 AM (9 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

trunk/src/lol/math/vector.h
r1177 r1209 72 72 inline Vec2<T> operator =(Vec2<T> const &that); 73 73 74 inline T& operator[]( int n)74 inline T& operator[](size_t n) 75 75 { 76 76 int i = (N >> (4 * (1  n))) & 3; 77 77 return static_cast<T*>(static_cast<void*>(this))[i]; 78 78 } 79 inline T const& operator[]( int n) const79 inline T const& operator[](size_t n) const 80 80 { 81 81 int i = (N >> (4 * (1  n))) & 3; … … 88 88 inline Vec3<T> operator =(Vec3<T> const &that); 89 89 90 inline T& operator[]( int n)90 inline T& operator[](size_t n) 91 91 { 92 92 int i = (N >> (4 * (2  n))) & 3; 93 93 return static_cast<T*>(static_cast<void*>(this))[i]; 94 94 } 95 inline T const& operator[]( int n) const95 inline T const& operator[](size_t n) const 96 96 { 97 97 int i = (N >> (4 * (2  n))) & 3; … … 104 104 inline Vec4<T> operator =(Vec4<T> const &that); 105 105 106 inline T& operator[]( int n)106 inline T& operator[](size_t n) 107 107 { 108 108 int i = (N >> (4 * (3  n))) & 3; 109 109 return static_cast<T*>(static_cast<void*>(this))[i]; 110 110 } 111 inline T const& operator[]( int n) const111 inline T const& operator[](size_t n) const 112 112 { 113 113 int i = (N >> (4 * (3  n))) & 3; … … 121 121 122 122 #define DECLARE_MEMBER_OPS(tname) \ 123 inline T& operator[]( int n) { return *(&this>x + n); } \124 inline T const& operator[]( int n) const { return *(&this>x + n); } \123 inline T& operator[](size_t n) { return *(&this>x + n); } \ 124 inline T const& operator[](size_t n) const { return *(&this>x + n); } \ 125 125 \ 126 126 /* Visual Studio insists on having an assignment operator. */ \ … … 1351 1351 v3((T)0, (T)0, (T)0, val) {} 1352 1352 1353 inline Vec4<T>& operator[]( int n) { return (&v0)[n]; }1354 inline Vec4<T> const& operator[]( int n) const { return (&v0)[n]; }1353 inline Vec4<T>& operator[](size_t n) { return (&v0)[n]; } 1354 inline Vec4<T> const& operator[](size_t n) const { return (&v0)[n]; } 1355 1355 1356 1356 T det() const;
Note: See TracChangeset
for help on using the changeset viewer.