Hi,
our default implementation for the .cast<NewType>() function makes use
of static_cast as in Eigen/src/Core/MathFunctions.h:395:
template<typename OldType, typename NewType>
struct cast_impl
{
static inline NewType run(const OldType& x)
{
return static_cast<NewType>(x);
}
};
Would not it be better to use constructors:
template<typename OldType, typename NewType>
struct cast_impl
{
static inline NewType run(const OldType& x)
{
return NewType(x);
}
};
which is more likely to be accepted by custom scalar types. Does
anyone see any drawbacks of such a change?