visual studio 2013 - C++ template : unable to match function definition to an existing declaration -


i designing templated vector2 class, game engine.

in order keep tidy, have been separating function declarations , definitions. working fine constructors, however, following error when trying same static function:

error c2244: 'spl::vector2<t>::dot' : unable match function definition existing  declaration 1>          definition 1>          't spl::vector2<t>::dot(const spl::vector2<l> &,const spl::vector2<r> &)' 1>          existing declarations 1>          't spl::vector2<t>::dot(const spl::vector2<l> &,const spl::vector2<r> &)' 

what finding unusual despite fact declaration , definition identical, compiler fails match them.

here vector2 class:

// vector2 class template <typename t>  class vector2{ public:      // constructor     vector2 ();     vector2 (t value);     vector2 (t xaxis, t yaxis);      // static functions     template <typename l, typename r>     static t dot (const vector2 <l>& lhs, const vector2 <r>& rhs);      // variables     t x, y; }; 

and here function declaration sits below it:

// return dot product of 2 vectors template <typename t, typename l, typename r> t vector2 <t>::dot (const vector2 <l>& lhs, const vector2 <r>& rhs){      t xaxis = (t) lhs.x * (t) rhs.x;     t yaxis = (t) lhs.y * (t) rhs.y;      return (xaxis + yaxis); } 

if knows why error being thrown , how fix it, forever in debt.

p.s. using visual studio 2013 ultimate, on windows 8.1 machine.

the syntax needs be:

template <typename t> template <typename l, typename r> t vector2 <t>::dot (const vector2 <l>& lhs, const vector2 <r>& rhs){      t xaxis = (t) lhs.x * (t) rhs.x;     t yaxis = (t) lhs.y * (t) rhs.y;      return (xaxis + yaxis); } 

Comments

Popular posts from this blog

python - mat is not a numerical tuple : openCV error -

c# - MSAA finds controls UI Automation doesn't -

wordpress - .htaccess: RewriteRule: bad flag delimiters -