aboutsummaryrefslogtreecommitdiff
path: root/doc/snippets/TopicAliasing_block.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'doc/snippets/TopicAliasing_block.cpp')
-rw-r--r--doc/snippets/TopicAliasing_block.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/doc/snippets/TopicAliasing_block.cpp b/doc/snippets/TopicAliasing_block.cpp
new file mode 100644
index 000000000..03282f4f0
--- /dev/null
+++ b/doc/snippets/TopicAliasing_block.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;
+
+// This assignment shows the aliasing problem
+mat.bottomRightCorner(2,2) = mat.topLeftCorner(2,2);
+cout << "After the assignment, mat = \n" << mat << endl;