   template deduction problem
  Here is the function prototype :template< int N >VectorN<N> solve(constType* v)const; //[1]template<int N>VectorN<N> solve(const VectorN<N>& v)const; //[2]constType is a typedef to const float. So a typical call would be :SquareMatrix::Type* m = {1,2,3,4}SquareMatrix m(m, m+ 4); //create a 2 x 2 matrixSquareMatrix::Type* v = {1,5}; //solve// { 1 2 } {x} = {1}// { 3 4 } {y} = {5}m.solve(v).print(); // call [1]but the m.solve gives me an error, saying that it cannot deduce the templateparameter, since it calls [1]. Is there a way to automate the process? Or shouldmake only [2] available?   
Quote:Original post by Concentratebut the m.solve gives me an error, saying that it cannot deduce the templateparameter, since it calls [1].How should it? You're effectively handing the compiler a pointer and asking it to deduce how many elements it points to. It can't do that.One thing you might try is using a reference to an array:template<std::size_t N>void foo(const int (&array)[N]){    std::cout << "array has " << N << " elements\n";};  These are member functions of the SquareMatrix, right?So, there is only one valid length of vector: as many elements as the size of the square matrix.So there is no reason for templating the member functions - just the class(es).// I assume you have something liketemplate <typename T, int N>class SquareMatrix { // ...// ... so then you declare the member functions like this:  typedef T Type;  typedef const T constType;  // look ma, no 'template' keyword  VectorN<N> solve(constType* v) const; // assumes N elements are pointed to.  // Or better yet, use an array reference, which is safe:  VectorN<N> solve(const Type(&v)[N]) const;  VectorN<N> solve(const VectorN<Type, N>& v) const;}