point: add free multiply operator

This commit is contained in:
Danny Robson 2015-01-21 23:38:09 +11:00
parent 6da2e2226c
commit 1b19dadd40
2 changed files with 7 additions and 0 deletions

View File

@ -178,6 +178,11 @@ util::operator* (const point<S,T> &p, const vector<S,T> &v)
{ return v * p; } { return v * p; }
//-----------------------------------------------------------------------------
template <size_t S, typename T>
util::point<S,T>
util::operator* (T a, const point<S,T> &b)
{ return b * a; }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@ -201,6 +206,7 @@ template struct util::point<S,T>;
template std::ostream& util::operator<< (std::ostream &os, const util::point<S,T>&); \ template std::ostream& util::operator<< (std::ostream &os, const util::point<S,T>&); \
template util::point<S,T> util::operator* (const point<S,T>&, const vector<S,T>&); \ template util::point<S,T> util::operator* (const point<S,T>&, const vector<S,T>&); \
template util::point<S,T> util::operator* (const vector<S,T>&, const point<S,T>&); \ template util::point<S,T> util::operator* (const vector<S,T>&, const point<S,T>&); \
template util::point<S,T> util::operator* (T, const point<S,T>&);
#define INSTANTIATE(T) \ #define INSTANTIATE(T) \
INSTANTIATE_S_T(1,T) \ INSTANTIATE_S_T(1,T) \

View File

@ -69,6 +69,7 @@ namespace util {
// free maths operators // free maths operators
template <size_t S, typename T> point<S,T> operator* (const vector<S,T>&, const point<S,T>&); template <size_t S, typename T> point<S,T> operator* (const vector<S,T>&, const point<S,T>&);
template <size_t S, typename T> point<S,T> operator* (const point<S,T>&, const vector<S,T>&); template <size_t S, typename T> point<S,T> operator* (const point<S,T>&, const vector<S,T>&);
template <size_t S, typename T> point<S,T> operator* (T, const point<S,T>&);
// iostream operators // iostream operators
template <size_t S, typename T> template <size_t S, typename T>