Re: smalleset() ( Re: [eigen] Householder.h: ::min() and operator<=)

[ Thread Index | Date Index | More Archives ]

On Mon, Sep 12, 2016 at 4:53 PM, Christoph Hertzberg <chtz@xxxxxxxxxxxxxxxxxxxxxxxx> wrote:
and CustomType does not have an implicit constructor from int

I guess that if CustomType has at least one implicit ctor from any primitive arithmetic types, then everything should be fine too. And it seems reasonable to me that any custom numeric type should provide such a ctor.

Perhaps, another solution would be to always write Literal(0),  Literal(1) instead of Scalar(x). By default, NumTraits<T>:: Literal is defined as T, and as NumTraits<Scalar>::Real for std::complex.

This is not much more typing (one more typedef here and there), and this is more efficient as this preserve the fact that the number is real.

This assumes that the following is fine for any T:

T r;
std::complex<T> c = r;


Mail converted by MHonArc 2.6.19+