diff options
author | Jitse Niesen <jitse@maths.leeds.ac.uk> | 2010-08-23 17:23:30 +0100 |
---|---|---|
committer | Jitse Niesen <jitse@maths.leeds.ac.uk> | 2010-08-23 17:23:30 +0100 |
commit | 474c2996bd7da42663bdc7696c2143f1ab1f1af5 (patch) | |
tree | 2a4f6a7e243b5c6549624a0b250dce0d96ff2ad4 /doc/snippets/TopicAliasing_block_correct.cpp | |
parent | d1111d625ccfc29a4b4a0db0192cbf6e2fdedf3c (diff) |
Docs: add section on resolving the aliasing issue.
Diffstat (limited to 'doc/snippets/TopicAliasing_block_correct.cpp')
-rw-r--r-- | doc/snippets/TopicAliasing_block_correct.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/doc/snippets/TopicAliasing_block_correct.cpp b/doc/snippets/TopicAliasing_block_correct.cpp new file mode 100644 index 000000000..6fee5801e --- /dev/null +++ b/doc/snippets/TopicAliasing_block_correct.cpp @@ -0,0 +1,7 @@ +MatrixXi mat(3,3); +mat << 1, 2, 3, 4, 5, 6, 7, 8, 9; +cout << "Here is the matrix mat:\n" << mat << endl; + +// The eval() solves the aliasing problem +mat.bottomRightCorner(2,2) = mat.topLeftCorner(2,2).eval(); +cout << "After the assignment, mat = \n" << mat << endl; |