diff --git a/include/vectorwrapper/vectorwrapper.inl b/include/vectorwrapper/vectorwrapper.inl index 1d2dca1..66552ea 100644 --- a/include/vectorwrapper/vectorwrapper.inl +++ b/include/vectorwrapper/vectorwrapper.inl @@ -360,7 +360,10 @@ namespace vwr { template inline Vec::type> operator+ (const Vec& parLeft, const Vec& parRight) { +#if defined(VWR_STATIC_CAST_RESULTS) typedef typename VectorWrapperInfo::type>::scalar_type scalar_type; +#endif + static_assert(static_cast(VectorWrapperInfo::dimensions) == static_cast(VectorWrapperInfo::dimensions), "Dimensions mismatch"); Vec::type> retval; for (int z = 0; z < VectorWrapperInfo::dimensions; ++z) { @@ -374,7 +377,10 @@ namespace vwr { } template inline Vec::type> operator- (const Vec& parLeft, const Vec& parRight) { +#if defined(VWR_STATIC_CAST_RESULTS) typedef typename VectorWrapperInfo::type>::scalar_type scalar_type; +#endif + static_assert(static_cast(VectorWrapperInfo::dimensions) == static_cast(VectorWrapperInfo::dimensions), "Dimensions mismatch"); Vec::type> retval; for (int z = 0; z < VectorWrapperInfo::dimensions; ++z) { @@ -388,7 +394,10 @@ namespace vwr { } template inline Vec::type> operator* (const Vec& parLeft, const Vec& parRight) { +#if defined(VWR_STATIC_CAST_RESULTS) typedef typename VectorWrapperInfo::type>::scalar_type scalar_type; +#endif + static_assert(static_cast(VectorWrapperInfo::dimensions) == static_cast(VectorWrapperInfo::dimensions), "Dimensions mismatch"); Vec::type> retval; for (int z = 0; z < VectorWrapperInfo::dimensions; ++z) { @@ -402,7 +411,10 @@ namespace vwr { } template inline Vec::type> operator/ (const Vec& parLeft, const Vec& parRight) { +#if defined(VWR_STATIC_CAST_RESULTS) typedef typename VectorWrapperInfo::type>::scalar_type scalar_type; +#endif + static_assert(static_cast(VectorWrapperInfo::dimensions) == static_cast(VectorWrapperInfo::dimensions), "Dimensions mismatch"); Vec::type> retval; for (int z = 0; z < VectorWrapperInfo::dimensions; ++z) {