aboutsummaryrefslogtreecommitdiffhomepage
path: root/doc/Pitfalls.dox
diff options
context:
space:
mode:
authorGravatar Gael Guennebaud <g.gael@free.fr>2015-09-02 11:23:55 +0200
committerGravatar Gael Guennebaud <g.gael@free.fr>2015-09-02 11:23:55 +0200
commitaba8c9ee176de6821ab483a0f284f725e0e5d603 (patch)
tree94bf466853f3f8abdaca54c06451abfa629fff3a /doc/Pitfalls.dox
parenta75616887ecce116639e332d476deafc7d833d67 (diff)
Add a documentation page for common pitfalls
Diffstat (limited to 'doc/Pitfalls.dox')
-rw-r--r--doc/Pitfalls.dox22
1 files changed, 22 insertions, 0 deletions
diff --git a/doc/Pitfalls.dox b/doc/Pitfalls.dox
new file mode 100644
index 000000000..203843ca7
--- /dev/null
+++ b/doc/Pitfalls.dox
@@ -0,0 +1,22 @@
+namespace Eigen {
+
+/** \page TopicPitfalls Common pitfalls
+
+\section TopicPitfalls_template_keyword Compilation error with template methods
+
+See this \link TopicTemplateKeyword page \endlink.
+
+\section TopicPitfalls_auto_keyword C++11 and the auto keyword
+
+In short: do not use the auto keywords with Eigen's expressions, unless you are 100% sure about what you are doing. In particular, do not use the auto keyword as a replacement for a Matrix<> type. Here is an example:
+
+\code
+MatrixXd A, B;
+auto C = A*B;
+for(...) { ... w = C * v; ...}
+\endcode
+
+In this example, the type of C is not a MatrixXd but an abstract expression representing a matrix product and storing references to A and B. Therefore, the product of A*B will be carried out multiple times, once per iteration of the for loop. Moreover, if the coefficients of A or B change during the iteration, then C will evaluate to different values.
+
+*/
+}