Registered Member
|
Hi,
for a software project I'm working on I need to write a class which has an Eigen matrix as a member. I wrote functions to access the Eigen matrix member by reference but I noticed something which I did not expect. To explain my problem I will use a little example code:
After compiling the code and running the executable I get the following:
What I would expect is that when I use the << operator and when I add mat3 = mat1 + mat2.eigen() the const version of eigen() is invoked similarly to when I use the function printer which I defined. Am I missing something and this is the way it is supposed to work? Thanks a lot! Carlo |
Moderator
|
this is just how c++ works, if your object is not const then the non-const versions of the method will be called by default.
|
Registered users: Bing [Bot], Google [Bot], Yahoo [Bot]