Closed NePutin94 closed 3 years ago
As I understood, I have to pass an instance of the type whose field I want to change. If I want to change the x field in class A, I have to do this: p2.set_value(b.a, 6.f);
. But how to use it when, for example, an object of some type T is passed to the function and this type contains some object whose field we want to change. That is, we can't pass the instance of this object to set_value because we don't know anything about the type T.
Apparently, variant does not refer to the object that is passed to it in any way. I have found a solution to my problem:
auto val2 = p.get_value(val);
p2.set_value(val2, 12.f);
p.set_value(test, val2);
i have two classes, one class contains an object of the other.
class A { public: float x; }; class B { public: A a; };
I'm trying to do something like this:And it doesn't work. Is it even possible?