Re: [eigen] What is the 'correct' way to pass matrix results?

[ Thread Index | Date Index | More lists.tuxfamily.org/eigen Archives ]


On 18.05.2011 18:35, Hauke Heibel wrote:
Ah, I see. But even here you need to know what you want to return.

Consider this example:

template<typename Derived>
<whatgoeshere??>  foo(const MatrixBase<Derived>&  m)
{
   return m*m;
}

in C++0x that would be

template<typename Derived>
auto foo(const MatrixBase<Derived>&  m) ->  decltype(m*m)
{
   return m*m;
}

where you provide type information via decltype. What I mean is that
as far as I can see, you are lost when the function becomes more
complex and have to fall back to hand written expressions.

Yeah, I haven't actually programmed in C++0x so far, and was not aware of the exact syntax at the moment. Actually, I was wondering how the return type would be determined for multiple return statements (so the decltype actually makes a little sense ...)

Thanks for your inputs,
Christoph

--
----------------------------------------------
Dipl.-Inf. Christoph Hertzberg
Cartesium 0.051
Universität Bremen
Enrique-Schmidt-Straße 5
28359 Bremen

Tel: (+49) 421-218-64252
----------------------------------------------



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/