Fix in Vector conversion.

No need for a conversion overload.
Conversion constructor should cast whatever it's assigning.
This commit is contained in:
King_DuckZ 2014-02-11 23:38:22 +01:00
parent 19ad7a77ea
commit ed4e73f0d9
3 changed files with 2 additions and 17 deletions

View file

@ -45,7 +45,7 @@ namespace cloonel {
if (m_texture) { if (m_texture) {
int width, height; int width, height;
SDL_QueryTexture(m_texture, nullptr, nullptr, &width, &height); SDL_QueryTexture(m_texture, nullptr, nullptr, &width, &height);
m_size = int2(width, height); m_size = static_cast<ushort2>(int2(width, height));
} }
} }

View file

@ -41,9 +41,6 @@ namespace cloonel {
template <typename U> const Vector& operator*= ( U parOther ); template <typename U> const Vector& operator*= ( U parOther );
template <typename U> const Vector& operator/= ( U parOther ); template <typename U> const Vector& operator/= ( U parOther );
template <typename U>
operator Vector<U, S> ( void );
T& operator[] ( uint32_t parIndex ) { return m_mem[parIndex]; } T& operator[] ( uint32_t parIndex ) { return m_mem[parIndex]; }
const T& operator[] ( uint32_t parIndex ) const { return m_mem[parIndex]; } const T& operator[] ( uint32_t parIndex ) const { return m_mem[parIndex]; }

View file

@ -13,7 +13,7 @@ namespace cloonel {
template <typename U> template <typename U>
Vector<T, S>::Vector (const Vector<U, S>& parOther) { Vector<T, S>::Vector (const Vector<U, S>& parOther) {
for (uint32_t z = 0; z < S; ++z) { for (uint32_t z = 0; z < S; ++z) {
m_mem[z] = parOther.m_mem[z]; m_mem[z] = static_cast<T>(parOther.m_mem[z]);
} }
} }
@ -87,18 +87,6 @@ namespace cloonel {
return *this; return *this;
} }
///-------------------------------------------------------------------------
///-------------------------------------------------------------------------
template <typename T, uint32_t S>
template <typename U>
Vector<T, S>::operator Vector<U, S>() {
Vector<U, S> retVal;
for (uint32_t z = 0; z < S; ++z) {
retVal[z] = m_mem[z];
}
return retVal;
}
///------------------------------------------------------------------------- ///-------------------------------------------------------------------------
///------------------------------------------------------------------------- ///-------------------------------------------------------------------------
template <typename T, typename U, uint32_t S> template <typename T, typename U, uint32_t S>