Skip to content

Instantly share code, notes, and snippets.

@ThePhD
Created September 29, 2014 00:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ThePhD/d29878ca31474abc6f2b to your computer and use it in GitHub Desktop.
Save ThePhD/d29878ca31474abc6f2b to your computer and use it in GitHub Desktop.
/*template <typename T, ulword n, typename TArith>
type<std::enable_if<std::is_arithmetic<TArith>::value, RVector<T, n>>>
operator + ( TArith right, const RVector<T, n>& left ) {
RVector<T, n> r;
for ( ulword i = 0; i < n; ++i ) {
r[ i ] = static_cast<T>( left[ i ] + right );
}
return r;
}
template <typename T, ulword n, typename TArith>
type<std::enable_if<std::is_arithmetic<TArith>::value, RVector<T, n>>>
operator + ( const RVector<T, n>& left, TArith right ) {
return right + left;
}*/
template <typename T, ulword n>
RVector<T, n> operator + ( T right, const RVector<T, n>& left ) {
RVector<T, n> r;
for ( ulword i = 0; i < n; ++i ) {
r[ i ] = static_cast<T>( left[ i ] + right );
}
return r;
}
template <typename T, ulword n>
RVector<T, n> operator + ( const RVector<T, n>& left, T right ) {
return right + left;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment