I want to design an API, which internally uses EIGEN.
Based on http://eigen.tuxfamily.org/dox/TopicPassingByValue.html, if a class have a Eigen object as member, it can not be passed by value.
Is there any straight forward way to tell compiler (e.g. g++) the my object can not be passed by value?
You can simply make the copy constructor unavailable. You can achieve this by using Boost and inheriting from
boost::noncopyable, or by making the copy constructor private:Or in the new C++ by explicitly deleting it:
You should probably also make your class unassignable by doing the same to the assignment operator (and
boost::noncopyabletakes care of this for you).