[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Toon-members] Template Return Function
From: |
Georg Klein |
Subject: |
Re: [Toon-members] Template Return Function |
Date: |
Sun, 10 Jan 2010 19:36:33 -0800 |
On 9 Jan 2010, at 08:32, Gabriel Nützi wrote:
Hello all,...
I have a question which I could (with my bare knowledge about
templates) not solve
I would like to have a TooN function which does the fallowing
template < int N, typename Base > Matrix< 6 , N , double,
Base> myFunction( int a ) ;
What I would like is to have as a return value a matrix which size
is defined in myFunction()....
and an assignment like this some how
Matrix<6,Dynamic,double> A = myFunction( 4 ); // Does not work,
can not deduce template arguments or something like that, (VB 2008)
Is this possible or how should I do this with a dynamic return value
which size is determined by myFunction?
You'd have to specify which version of the template you want when
calling the function, since the compiler cannot resolve overloads
based on return value. I think the syntax may be something like
Matrix<6,Dynamic, double> A = myFunction<6,Dynamic,double>(4)