Fix SWIG compile

SWIG doesn't like a lot of the new C++20 elements, so fall back to basic
cast that should get almost every case
This commit is contained in:
Seth Hillbrand 2024-06-14 17:41:05 -07:00
parent 6df16d053e
commit f7450e5b37
1 changed files with 17 additions and 1 deletions

View File

@ -439,12 +439,20 @@ VECTOR2<std::common_type_t<T, U>> operator+( const VECTOR2<T>& aLHS, const U& aS
}
// SWIG doesn't handle this template correctly
#ifndef SWIG
template <class T>
VECTOR2<T> operator+( const VECTOR2<T>& aVector, std::unsigned_integral auto aScalar )
{
return VECTOR2<T>( aVector.x + aScalar, aVector.y + aScalar );
}
#else
template <class T>
VECTOR2<T> operator+( const VECTOR2<T>& aVector, unsigned aScalar )
{
return VECTOR2<T>( aVector.x + aScalar, aVector.y + aScalar );
}
#endif
template <class T, class U>
VECTOR2<std::common_type_t<T, U>> operator-( const VECTOR2<T>& aLHS, const VECTOR2<U>& aRHS )
@ -459,11 +467,19 @@ VECTOR2<std::common_type_t<T, U>> operator-( const VECTOR2<T>& aLHS, const U& aS
return VECTOR2<std::common_type_t<T, U>>( aLHS.x - aScalar, aLHS.y - aScalar );
}
#ifndef SWIG
template <class T>
VECTOR2<T> operator-( const VECTOR2<T>& aVector, std::unsigned_integral auto aScalar )
{
return VECTOR2<T>( aVector.x - aScalar, aVector.y - aScalar );
}
#else
template <class T>
VECTOR2<T> operator-( const VECTOR2<T>& aVector, unsigned aScalar )
{
return VECTOR2<T>( aVector.x - aScalar, aVector.y - aScalar );
}
#endif
template <class T>