Re: [eigen] Signed-ness of size types, and better constructors for Matrix

[ Thread Index | Date Index | More Archives ]


For int vs. unsigned int, one reason for our choice is that we can do
backwards for loops like

for( int i = size()-1; i >= 0; --i)

without risk (and compilers didn't always issue warnings as soon as
the situation was a bit more subtle). After having spent hours on a
bug like that, that was a very compelling argument :)

The situation for the STL is different, they try to be completely
general and lowlevel so they want their arrays to be able to have any
size up to the maximum memory size, so they must use size_t; by
contrast Eigen is just a specialized library and in our context,
"unsigned" only brings some trouble and no intrinsic advantage.

The problem with passing unsigned ints to the constructors could then
be reversed: if our constructors took unsigned arguments, then people
trying to pass plain ints would have the same problem....

> The Matrix constructors should use some equivalent of boost::enable_if so
> they are only available when they should be

Ah, that sounds like a good idea. I will try it. But at some point
(maybe at a different place) Gael tried something like that and there
was an issue, but I don't remember. Yes the macro trick with
EIGEN_PARSED_BY_DOXYGEN seems useful to prevent documentation from
being affected by that.


Mail converted by MHonArc 2.6.19+