Math/Vector[I]: Replace implicit pointer conversion by [] operator overload
This commit is contained in:
@@ -494,29 +494,25 @@ namespace Nz
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Converts vector to pointer to its own data
|
||||
* \return A pointer to the own data
|
||||
*
|
||||
* \remark Access to index greather than 3 is undefined behavior
|
||||
* \brief Access a vector component by index
|
||||
* \return X, Y, Z depending on index (0, 1, 2)
|
||||
*/
|
||||
|
||||
template<typename T>
|
||||
Vector4<T>::operator T* ()
|
||||
T& Vector4<T>::operator[](std::size_t i)
|
||||
{
|
||||
return &x;
|
||||
NazaraAssert(i < 4, "index out of range");
|
||||
return *(&x + i);
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Converts vector to const pointer to its own data
|
||||
* \return A constant pointer to the own data
|
||||
*
|
||||
* \remark Access to index greather than 3 is undefined behavior
|
||||
* \brief Access a vector component by index
|
||||
* \return X, Y, Z depending on index (0, 1, 2)
|
||||
*/
|
||||
|
||||
template<typename T>
|
||||
Vector4<T>::operator const T* () const
|
||||
T Vector4<T>::operator[](std::size_t i) const
|
||||
{
|
||||
return &x;
|
||||
NazaraAssert(i < 4, "index out of range");
|
||||
return *(&x + i);
|
||||
}
|
||||
|
||||
/*!
|
||||
|
||||
Reference in New Issue
Block a user