[eigen] a few updates...

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


I'm sorry to have been quiet lately as beta3 is getting more and more
late. Here's my current status:

* I'm done fixing bug 54 as far as I'm concerned, with a local patch.
However, due to limited internet connectivity (in vacation in that
remote place called San Francisco, they have barely heard about the
Internet there and think they can charge me 15$/night for internet in
my hotel room) I can't push my changes ... writing this from IE7 on a
windows machine in the hotel, grrr -_-

* There are 2 remaining places where I haven't fixed
const-correctness: the Sparse module (leaving this to Gael) and
swap(). I have improved the situation with swap() so that e.g. you
can't swap const Matrix's anymore, but there remains a much trickier
issue: swapping temporary expression as in:


This is incredibly tricky because C++ doesn't allow one to take
non-const references to temporaries, so one has to pass const
references and const_cast, which loses the information of whether the
expression was const in the first place.

There are 2 things we can do here:
a) leave it there with c++98 and consider using rvalue references in c++0x mode
b) actually there is a crazy aspect of c++98 that allows to fix this
problem. As I said, the fundamental issue is that C++ doesn't allow
one to take non-const references to temporaries... but that's not
entirely true, there's one case in which this is allowed: that's when
taking a reference to *this. At least insofar as GCC's behavior is
compliant with the spec. So, while the API we have for swap() can't be
fixed wrt const-correctness within c++98, this different API:

   xpr1.swap() = xpr2.swap()

can be made const-correct, by implementing swap() as returning a
SwapWrapper<T>, and implementing swap() const as returning a
SwapWrapper<const T>.

Do you want us to:
 - stick with a) only ?
 - introduce API b) and keep a) ?
 - introduce API b) and keep a)  as deprecated ?
 - introduce API b) and remove a) from eigen3 (keep it in eigen2support) ?


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