Re: [eigen] Let's get reshape in shape for 3.4

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



On Tue, Feb 21, 2017 at 5:24 PM, Gael Guennebaud <gael.guennebaud@xxxxxxxxx> wrote:
Perhaps it could be possible to get rid of ColOrder, RowOrder and re-use ColMajor/RowMajor if we redefine them as follows:

enum ColMajor_t { ColMajor = 0 };
enum RowMajor_t { RowMajor = 1 };

so that they also convey different types. I'm a bit afraid of backward compatibility issues though... Any thoughts on that matter?

I give it a try, and and everything compile and run fine expect that it gives tons of warning every time we mix both enums in the same expressions, like:

 cond ? RowMajor : ColMajor

In c++11, a better and working solution would be:

  static constexpr std::integral_constant<int,1> RowMajor{};
  static constexpr std::integral_constant<int,0> ColMajor{};

but there really is no c++98 fallback for that!

Perhaps we could redefine RowMajorColMajor this way in c++11, and provide the new ColOrder/RowOrder for the few users that are still stuck to c++98? Or even more radically, make the controllable order a C++11 feature only? 

gael




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