mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
Fix outdated documentation across multiple .dox files
libeigen/eigen!2148 Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
This commit is contained in:
@@ -4,7 +4,11 @@ namespace Eigen {
|
||||
|
||||
Passing objects by value is almost always a very bad idea in C++, as this means useless copies, and one should pass them by reference instead.
|
||||
|
||||
With %Eigen, this is even more important: passing \ref TopicFixedSizeVectorizable "fixed-size vectorizable Eigen objects" by value is not only inefficient, it can be illegal or make your program crash! And the reason is that these %Eigen objects have alignment modifiers that aren't respected when they are passed by value.
|
||||
\note If you are compiling in C++17 mode with a sufficiently recent compiler (GCC >= 7, Clang >= 5, MSVC >= 19.12),
|
||||
the alignment issues described below are handled automatically by the compiler, and passing %Eigen objects by value
|
||||
is safe (though still less efficient than passing by const reference).
|
||||
|
||||
With pre-C++17 compilers, passing \ref TopicFixedSizeVectorizable "fixed-size vectorizable Eigen objects" by value is not only inefficient, it can be illegal or make your program crash! And the reason is that these %Eigen objects have alignment modifiers that aren't respected when they are passed by value.
|
||||
|
||||
For example, a function like this, where \c v is passed by value:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user