aboutsummaryrefslogtreecommitdiff
path: root/doc/snippets/Tutorial_std_sort_rows_cxx11.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'doc/snippets/Tutorial_std_sort_rows_cxx11.cpp')
-rw-r--r--doc/snippets/Tutorial_std_sort_rows_cxx11.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/doc/snippets/Tutorial_std_sort_rows_cxx11.cpp b/doc/snippets/Tutorial_std_sort_rows_cxx11.cpp
new file mode 100644
index 000000000..03641603d
--- /dev/null
+++ b/doc/snippets/Tutorial_std_sort_rows_cxx11.cpp
@@ -0,0 +1,5 @@
+ArrayXXi A = ArrayXXi::Random(4,4).abs();
+cout << "Here is the initial matrix A:\n" << A << "\n";
+for(auto row : A.rowwise())
+ std::sort(row.begin(), row.end());
+cout << "Here is the sorted matrix A:\n" << A << "\n";