TopicAliasing_block_correct.cpp revision c981c48f5bc9aefeffc0bcb0cc3934c2fae179dd
1MatrixXi mat(3,3);
2mat << 1, 2, 3,   4, 5, 6,   7, 8, 9;
3cout << "Here is the matrix mat:\n" << mat << endl;
4
5// The eval() solves the aliasing problem
6mat.bottomRightCorner(2,2) = mat.topLeftCorner(2,2).eval();
7cout << "After the assignment, mat = \n" << mat << endl;
8