Removed explicit VectorI::operator[]
Since Vector instances can be implicitely converted to T*, native operator[] will work on them Former-commit-id: 3f4a1822c514886dee7d9e5dab816c80e5c5ee99
This commit is contained in:
parent
dcca3d03d4
commit
032b2ed79b
|
|
@ -55,9 +55,6 @@ class NzVector2
|
||||||
operator T*();
|
operator T*();
|
||||||
operator const T*() const;
|
operator const T*() const;
|
||||||
|
|
||||||
T& operator[](unsigned int i);
|
|
||||||
T operator[](unsigned int i) const;
|
|
||||||
|
|
||||||
const NzVector2& operator+() const;
|
const NzVector2& operator+() const;
|
||||||
NzVector2 operator-() const;
|
NzVector2 operator-() const;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -226,40 +226,6 @@ NzVector2<T>::operator const T*() const
|
||||||
return &x;
|
return &x;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
|
||||||
T& NzVector2<T>::operator[](unsigned int i)
|
|
||||||
{
|
|
||||||
#if NAZARA_MATH_SAFE
|
|
||||||
if (i >= 2)
|
|
||||||
{
|
|
||||||
NzStringStream ss;
|
|
||||||
ss << "Index out of range: (" << i << " >= 2)";
|
|
||||||
|
|
||||||
NazaraError(ss);
|
|
||||||
throw std::domain_error(ss.ToString());
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return *(&x+i);
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename T>
|
|
||||||
T NzVector2<T>::operator[](unsigned int i) const
|
|
||||||
{
|
|
||||||
#if NAZARA_MATH_SAFE
|
|
||||||
if (i >= 2)
|
|
||||||
{
|
|
||||||
NzStringStream ss;
|
|
||||||
ss << "Index out of range: (" << i << " >= 2)";
|
|
||||||
|
|
||||||
NazaraError(ss);
|
|
||||||
throw std::domain_error(ss.ToString());
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return *(&x+i);
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
const NzVector2<T>& NzVector2<T>::operator+() const
|
const NzVector2<T>& NzVector2<T>::operator+() const
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -67,9 +67,6 @@ template<typename T> class NzVector3
|
||||||
operator T*();
|
operator T*();
|
||||||
operator const T*() const;
|
operator const T*() const;
|
||||||
|
|
||||||
T& operator[](unsigned int i);
|
|
||||||
T operator[](unsigned int i) const;
|
|
||||||
|
|
||||||
const NzVector3& operator+() const;
|
const NzVector3& operator+() const;
|
||||||
NzVector3 operator-() const;
|
NzVector3 operator-() const;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -306,40 +306,6 @@ NzVector3<T>::operator const T*() const
|
||||||
return &x;
|
return &x;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
|
||||||
T& NzVector3<T>::operator[](unsigned int i)
|
|
||||||
{
|
|
||||||
#if NAZARA_MATH_SAFE
|
|
||||||
if (i >= 3)
|
|
||||||
{
|
|
||||||
NzStringStream ss;
|
|
||||||
ss << "Index out of range: (" << i << " >= 3)";
|
|
||||||
|
|
||||||
NazaraError(ss);
|
|
||||||
throw std::out_of_range(ss.ToString());
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return *(&x+i);
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename T>
|
|
||||||
T NzVector3<T>::operator[](unsigned int i) const
|
|
||||||
{
|
|
||||||
#if NAZARA_MATH_SAFE
|
|
||||||
if (i >= 3)
|
|
||||||
{
|
|
||||||
NzStringStream ss;
|
|
||||||
ss << "Index out of range: (" << i << " >= 3)";
|
|
||||||
|
|
||||||
NazaraError(ss);
|
|
||||||
throw std::out_of_range(ss.ToString());
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return *(&x+i);
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
const NzVector3<T>& NzVector3<T>::operator+() const
|
const NzVector3<T>& NzVector3<T>::operator+() const
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -50,9 +50,6 @@ template<typename T> class NzVector4
|
||||||
operator T*();
|
operator T*();
|
||||||
operator const T*() const;
|
operator const T*() const;
|
||||||
|
|
||||||
T& operator[](unsigned int i);
|
|
||||||
T operator[](unsigned int i) const;
|
|
||||||
|
|
||||||
const NzVector4& operator+() const;
|
const NzVector4& operator+() const;
|
||||||
NzVector4 operator-() const;
|
NzVector4 operator-() const;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -233,40 +233,6 @@ NzVector4<T>::operator const T*() const
|
||||||
return &x;
|
return &x;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
|
||||||
T& NzVector4<T>::operator[](unsigned int i)
|
|
||||||
{
|
|
||||||
#if NAZARA_MATH_SAFE
|
|
||||||
if (i >= 4)
|
|
||||||
{
|
|
||||||
NzStringStream ss;
|
|
||||||
ss << "Index out of range: (" << i << " >= 4)";
|
|
||||||
|
|
||||||
NazaraError(ss);
|
|
||||||
throw std::domain_error(ss.ToString());
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return *(&x+i);
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename T>
|
|
||||||
T NzVector4<T>::operator[](unsigned int i) const
|
|
||||||
{
|
|
||||||
#if NAZARA_MATH_SAFE
|
|
||||||
if (i >= 4)
|
|
||||||
{
|
|
||||||
NzStringStream ss;
|
|
||||||
ss << "Index out of range: (" << i << " >= 4)";
|
|
||||||
|
|
||||||
NazaraError(ss);
|
|
||||||
throw std::domain_error(ss.ToString());
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return *(&x+i);
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
const NzVector4<T>& NzVector4<T>::operator+() const
|
const NzVector4<T>& NzVector4<T>::operator+() const
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue