Re: [eigen] Strange operator behaviour |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]
On 19.09.2014 15:01, mwb@xxxxxxxxxxxx wrote:
Personally, I would prefer to make expression ctors explicit, since the
current behavior is quite unintuitive and potentially dangerous, though
you probably get used to it.
I totally agree on making any constructor explicit when in:
X x; // some kind of expression or scalar
A a1(x);
A a2; a2=x;
The last line is either not possible or leads to different behavior than
the line before. In other words, only make it implicit if
A a3=x;
has the same result as the a2 case.
I can't think of any case, where we would break intended behavior with
changing that -- I guess it will rather make some show some unintended
misuses visible.
I agree that usage will be a bit more painful, e.g.
TransposeType transpose() const {
return derived();
}
and related, would need to be replaced by (the IMO easier to understand):
TransposeType transpose() const {
return TransposeType(derived());
}
Actually, this would also motivate to consequently add typedefs for all
return types.
Does Eigen3.2.2 somewhere overrides the ?: operator with some strange side
effects?
Overloading ?: is not possible:
http://en.wikipedia.org/wiki/Operators_in_C_and_C++#Other_operators
Christoph
--
----------------------------------------------
Dipl.-Inf., Dipl.-Math. Christoph Hertzberg
Cartesium 0.049
Universität Bremen
Enrique-Schmidt-Straße 5
28359 Bremen
Tel: +49 (421) 218-64252
----------------------------------------------