Re: [eigen] Feature proposal - add error string to help debug const/non-const mapping errors

[ Thread Index | Date Index | More Archives ]

On 03.03.2013 00:58, Rohit Garg wrote:
Hi all,

I have been using the Map objects a lot lately, and I have seen that
often, a simple mistake of mapping a const pointer as, say, MatrixXd.
Obviously, this leads to a big compiler error, which is often
difficult to decipher. I propose that a small error string be added to
Map object, which will aid debugging. Something similar to

This could prove very helpful. I know 3.2 beta is being planned, just
how big a change is this?

I guess that's a rather small change (basically provide a const Scalar* constructor which has a static assertion).
But I would vote against suggesting to "use_cast" in the error string.
Maybe something like expecting_a_non_const_pointer or check_your_const_correctness, though this might be also a bit confusing to the novice (but it would be easier to provide a FAQ entry for that).


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

Tel: +49 (421) 218-64252

Mail converted by MHonArc 2.6.19+