Work around MSVC issue in Block XprType.

This commit is contained in:
Antonio Sánchez 2023-10-19 22:02:03 +00:00
parent 877c2d1e9b
commit aa6964bf3a

View File

@ -20,41 +20,40 @@ namespace internal {
template<typename XprType_, int BlockRows, int BlockCols, bool InnerPanel_> template<typename XprType_, int BlockRows, int BlockCols, bool InnerPanel_>
struct traits<Block<XprType_, BlockRows, BlockCols, InnerPanel_> > : traits<XprType_> struct traits<Block<XprType_, BlockRows, BlockCols, InnerPanel_> > : traits<XprType_>
{ {
typedef XprType_ XprType; typedef typename traits<XprType_>::Scalar Scalar;
typedef typename traits<XprType>::Scalar Scalar; typedef typename traits<XprType_>::StorageKind StorageKind;
typedef typename traits<XprType>::StorageKind StorageKind; typedef typename traits<XprType_>::XprKind XprKind;
typedef typename traits<XprType>::XprKind XprKind; typedef typename ref_selector<XprType_>::type XprTypeNested;
typedef typename ref_selector<XprType>::type XprTypeNested;
typedef std::remove_reference_t<XprTypeNested> XprTypeNested_; typedef std::remove_reference_t<XprTypeNested> XprTypeNested_;
enum{ enum{
MatrixRows = traits<XprType>::RowsAtCompileTime, MatrixRows = traits<XprType_>::RowsAtCompileTime,
MatrixCols = traits<XprType>::ColsAtCompileTime, MatrixCols = traits<XprType_>::ColsAtCompileTime,
RowsAtCompileTime = MatrixRows == 0 ? 0 : BlockRows, RowsAtCompileTime = MatrixRows == 0 ? 0 : BlockRows,
ColsAtCompileTime = MatrixCols == 0 ? 0 : BlockCols, ColsAtCompileTime = MatrixCols == 0 ? 0 : BlockCols,
MaxRowsAtCompileTime = BlockRows==0 ? 0 MaxRowsAtCompileTime = BlockRows==0 ? 0
: RowsAtCompileTime != Dynamic ? int(RowsAtCompileTime) : RowsAtCompileTime != Dynamic ? int(RowsAtCompileTime)
: int(traits<XprType>::MaxRowsAtCompileTime), : int(traits<XprType_>::MaxRowsAtCompileTime),
MaxColsAtCompileTime = BlockCols==0 ? 0 MaxColsAtCompileTime = BlockCols==0 ? 0
: ColsAtCompileTime != Dynamic ? int(ColsAtCompileTime) : ColsAtCompileTime != Dynamic ? int(ColsAtCompileTime)
: int(traits<XprType>::MaxColsAtCompileTime), : int(traits<XprType_>::MaxColsAtCompileTime),
XprTypeIsRowMajor = (int(traits<XprType>::Flags)&RowMajorBit) != 0, XprTypeIsRowMajor = (int(traits<XprType_>::Flags)&RowMajorBit) != 0,
IsRowMajor = (MaxRowsAtCompileTime==1&&MaxColsAtCompileTime!=1) ? 1 IsRowMajor = (MaxRowsAtCompileTime==1&&MaxColsAtCompileTime!=1) ? 1
: (MaxColsAtCompileTime==1&&MaxRowsAtCompileTime!=1) ? 0 : (MaxColsAtCompileTime==1&&MaxRowsAtCompileTime!=1) ? 0
: XprTypeIsRowMajor, : XprTypeIsRowMajor,
HasSameStorageOrderAsXprType = (IsRowMajor == XprTypeIsRowMajor), HasSameStorageOrderAsXprType = (IsRowMajor == XprTypeIsRowMajor),
InnerSize = IsRowMajor ? int(ColsAtCompileTime) : int(RowsAtCompileTime), InnerSize = IsRowMajor ? int(ColsAtCompileTime) : int(RowsAtCompileTime),
InnerStrideAtCompileTime = HasSameStorageOrderAsXprType InnerStrideAtCompileTime = HasSameStorageOrderAsXprType
? int(inner_stride_at_compile_time<XprType>::ret) ? int(inner_stride_at_compile_time<XprType_>::ret)
: int(outer_stride_at_compile_time<XprType>::ret), : int(outer_stride_at_compile_time<XprType_>::ret),
OuterStrideAtCompileTime = HasSameStorageOrderAsXprType OuterStrideAtCompileTime = HasSameStorageOrderAsXprType
? int(outer_stride_at_compile_time<XprType>::ret) ? int(outer_stride_at_compile_time<XprType_>::ret)
: int(inner_stride_at_compile_time<XprType>::ret), : int(inner_stride_at_compile_time<XprType_>::ret),
// FIXME, this traits is rather specialized for dense object and it needs to be cleaned further // FIXME, this traits is rather specialized for dense object and it needs to be cleaned further
FlagsLvalueBit = is_lvalue<XprType>::value ? LvalueBit : 0, FlagsLvalueBit = is_lvalue<XprType_>::value ? LvalueBit : 0,
FlagsRowMajorBit = IsRowMajor ? RowMajorBit : 0, FlagsRowMajorBit = IsRowMajor ? RowMajorBit : 0,
Flags = (traits<XprType>::Flags & (DirectAccessBit | (InnerPanel_?CompressedAccessBit:0))) | FlagsLvalueBit | FlagsRowMajorBit, Flags = (traits<XprType_>::Flags & (DirectAccessBit | (InnerPanel_?CompressedAccessBit:0))) | FlagsLvalueBit | FlagsRowMajorBit,
// FIXME DirectAccessBit should not be handled by expressions // FIXME DirectAccessBit should not be handled by expressions
// //
// Alignment is needed by MapBase's assertions // Alignment is needed by MapBase's assertions