Hi,
Just encountered a very weird error while compiling a very simple class template.
This does not compile:
Code:
#ifndef __MATRIX_
#define __MATRIX_
#include <fstream>
#include <iostream>
#include <valarray>
namespace LinearAlgrebra
{
template<typename T> class Matrix
{
public:
Matrix();
private:
size_t _nbrows;
size_t _nbcols;
valarray<T> _elms; // vector of column vectors
}; // end class template
};
#endif
with the messages
1>d:\src\pluginlib\inc\LinearAlgebra/Matrix.h(25) : error C2143: syntax error : missing ';' before '<'
1> d:\src\pluginlib\inc\LinearAlgebra/Matrix.h(27) : see reference to class template instantiation 'LinearAlgrebra::Matrix<T>' being compiled
1>d:\src\pluginlib\inc\LinearAlgebra/Matrix.h(25) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>d:\src\pluginlib\inc\LinearAlgebra/Matrix.h(25) : error C2238: unexpected token(s) preceding ';'
Does it somehow not recognize the 'valarray<T>' ? I really don't understand....