c++ passing non-templated eigen vector as function argument and modifying it in the function -


i implementing function member of derived class (declared virtual in base class). 1 of arguments vectorxd , result of operation stored.

i read "writing functions taking eigen types parameters" (http://eigen.tuxfamily.org/dox/topicfunctiontakingeigentypes.html) , hack relies on templated functions, focusing in generic eigen object possible parameter. in case don't think it'll work because seems can't mix virtual , template.

on other hand, know argument going of type vectorxd, , can resize right size before going function no resizing necessary inside function. trying approach of passing vector reference const , using const_cast able make modifications need, still linking error:

error lnk2001: unresolved external symbol "public: virtual void __thiscall problem::f(class method *,class eigen::matrix const &,class eigen::matrix const &)" (?f@problem@@uaexpavmethod@@abv?$matrix@n$0?0$00$0a@$0?0$00@eigen@@1@z)

here, 'problem' base class, 'f' function, , 'method' class (i need object of type inside function too).

in definition of problem have:

virtual void f(method *m, const eigen::vectorxd &x, eigen::vectorxd const &y); 

in definition of derived:problem have:

void f(method *m, const eigen::vectorxd &x, eigen::vectorxd const &y) {...}; 

'y' need store result. suggestions on how achieve this? in advanced.

if base class abstract, set method =0 , pure virtual.

if base class not abstract, may not need method. not include in base class.

if base class not abstract, need able perform operation on every instance of base class on derived, need implement function in base class derived.


Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -