|
From: | E. Rosten |
Subject: | Re: [Toon-members] Problem with const correctness fix/Jan 11, 2010 |
Date: | Mon, 18 Jan 2010 15:33:13 +0000 (GMT) |
User-agent: | Alpine 2.00 (LSU 1167 2008-08-23) |
On Mon, 18 Jan 2010, Ville Kyrki wrote:
Hi, I've been passing a slice to SO3::exp() as a parameter and the const correctness fixes on Jan 11 seem to have broken that.
OK, it is fixed now. Unfortunately, it is not possible to get C++ to do quite the right thing with regards to const. The old solution yielded undefined behaviour. The new one requires a little more care with implementation, so I expect for the odd bug like this to crop up now and again until they're all fixed.
Example: void foo(TooN::Vector<6>& v) { TooN::SO3<double>::exp(v.slice<3,3>()); } is broken currently (I don't know if it's supposed to work, but it did earlier). slice can be of course avoided with a temporary vector, but using slice would make things nicer. I'm not sure, but it seems to me that the fix would need to be made in so3.h, although SO3::exp was already parametrized with the precision parameter (as suggested in the comment to the const correctness fix): template <typename Prec> template <int S, typename VA> SO3<Prec>::exp(const Vector<S,Prec,VA>& w)
The problem is that the SO3 class is templated, but not the member function. That has changed now.
-Ed -- (You can't go wrong with psycho-rats.)(http://mi.eng.cam.ac.uk/~er258) /d{def}def/f{/Times s selectfont}d/s{11}d/r{roll}d f 2/m{moveto}d -1 r 230 350 m 0 1 179{ 1 index show 88 rotate 4 mul 0 rmoveto}for/s 12 d f pop 235 420 translate 0 0 moveto 1 2 scale show showpage
[Prev in Thread] | Current Thread | [Next in Thread] |