ahoj mam mensi problem
template <typename T, typename K>
class Matrix;
template <typename T, typename K>
Matrix<T,K>& operator*(const K left, Matrix<T,K>& right)
template <typename T, typename K>
class Matrix
{
public:
friend Matrix<T,K>& operator*(const K left, Matrix<T,K>& right)
};
template <typename T, typename K>
Matrix<T,K>& operator*(const K left, Matrix<T,K>& rigt)
{
...;
return right;
}
napise mi to pri prekladani (debian 6.01, amd64, gcc ver. 4.4.5)
"g++ -Wall -std=c++0x Matrix.cpp"
In file included from ../XMatrix.hpp:7,
from XMatrix_test.cpp:1:
../../MathGeometry/Matrix/Matrix.hpp:70: warning: friend declaration ‘MathGeometry::Matrix<T, K>& MathGeometry::operator*(K, MathGeometry::Matrix<T, K>&)’ declares a non-template function
../../MathGeometry/Matrix/Matrix.hpp:70: note: (if this is not what you intended, make sure the function template has already been declared and add <> after the function name here)
../../MathGeometry/Matrix/Matrix.hpp:71: warning: friend declaration ‘MathGeometry::Matrix<T, K>& MathGeometry::operator+(K, MathGeometry::Matrix<T, K>&)’ declares a non-template function
kdyz to upravim na
template <typename T, typename K>
class Matrix;
template <typename T, typename K>
Matrix<T,K>& operator*(const K left, Matrix<T,K>& right)
template <typename T, typename K>
class Matrix
{
public:
friend Matrix<T,K>& (operator*<>)(const K left, Matrix<T,K>& right)
};
template <typename T, typename K>
Matrix<T,K>& operator*(const K left, Matrix<T,K>& rigt)
{
...;
return right;
}
tak to pro zmenu napise
hGeometry/Matrix/Matrix.hpp:70: error: expected ‘)’ before ‘<’ token
../../MathGeometry/Matrix/Matrix.hpp:70: error: expected ‘;’ before ‘<’ token
../../MathGeometry/Matrix/Matrix.hpp:71: error: expected ‘)’ before ‘<’ token
../../MathGeometry/Matrix/Matrix.hpp:71: error: expected ‘;’ before ‘<’ token
Nevite nahodou nekdo co stim ?? Jsem z toho celi nestastny ...