Search code examples
c++pass-by-referenceboost-bindmemory-alignmenteigen

Does using Eigen types with boost::bind automatically violate Eigen's "only pass by reference" rule?


Because libeigen does special work to adjust the memory alignment of all of its types, it has a special rule that says that in passing eigen types as arguments that they should always be pass-by-reference.

However I believe boost::bind implicitly passes by value.

My intuition is that using boost::bind with eigen types (and without using boost:ref) would violate Eigen's pass-by-reference rule, and thus cause problems.

Can anyone confirm this?


Solution

  • boost::bind will effectively pass arguments as values. Unless you wrap them with boost::(c)ref, then it would be just the wrapper which gets passed by value.