Re: [eigen] Specializing max_coeff_visitor for some number types

[ Thread Index | Date Index | More lists.tuxfamily.org/eigen Archives ]


On 26.05.2014 13:56, Marc Glisse wrote:
On Mon, 26 May 2014, Christoph Hertzberg wrote:
I don't know what would be the least ugly and least intrusive way. I'm
afraid that
 internal::is_same<scalar_abs_op, scalar_score_coeff_op>::value
will not work.

More like std::is_base_of in this case.

Well, even if we re-implement is_base_of (to stay C++98 compatible) this won't be a good idea, because users might inherit from abs but redefine the function.

Maybe add another flag to
 functor_traits<scalar_score_coeff_op<Scalar> >?

I was thinking of adding some typedef (or static enum or whatever) in
the default implementation of scalar_score_coeff_op and testing for the
existence of that typedef. Unless some user defines his own
scalar_score_coeff_op<Type> specialization by deriving from
scalar_score_coeff_op<OtherType>, it should detect if the user
specialized scalar_score_coeff_op without the risk of forgetting to
update functor_traits. Does that seem ok?

Yes, directly adding an enum to scalar_score_coeff_op is certainly safer to avoid unexpected behavior if the user forgets to implement something.


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
----------------------------------------------



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/