From: Kris Thielemans <kris.f.thielemans@gm...>  20140615 08:44:09

> From: Joel Andersson, Sent: 15 June 2014 09:28 > > <snip> if you wrap a function > > const float& a(); > > Swig_MATLAB_NewPointerObj will attempt to create an object of type > p_float, which matlab doesn't know what to do with, so we will fall back to a > SwigRef. This example looks a bit artificial, but I get it because I am using > templates ("template <class T> const T& a()") which I then instantiate with > T=float. In C++, that's fine, but in MATLAB, we now end up with a largely > unusable value. This is the same for other languages though (I think). > > > > I don't see how this is related to the MATLAB module. My understanding is that > if you want to define a different behavior, you have to define an output > typemap. > Sure. I agree. I don't think this is MATLAB specific, and it's not really an "issue" with swig. It's (at least currently) up to the user to handle this ok. Of course, it does mean we have to handle it correctly in the MATLABmodule of swig (i.e. handle it in the same way as other languages), which I think we do. 