Eigen: Return a reference to a block of a matrix with compile-time dimension checks
问题 What I am asking is a generalization of this question. Specifically, I would like to make a C++ Eigen wrapper around a legacy C and Fortran library, which uses a 2D data-structure: [ x[0,0] ... x[0,w-1] ] [ u[0,0] ... u[0,w-1] ] [ ... ] [ x[c-1,0] ... x[c-1,w-1] ] [ u[c-1,0] ... u[c-1,w-1] ] where each of the entries x[i,j] and u[i,j] are themselves column vectors of size ( nx1 ) and ( mx1 ) respectively. This leads to some complicated (and error prone) pointer arithmetic as well as some very