I have a problem I am currently facing and I'm wondering if the community could help me out. I find it's probably easier to explain with an example.
struct Derived : public Base
Derived(float newX) : x(newX)
struct Unrelated : public Base
Unrelated(char val) : v(val)
// How to copy the data that's in mBaseArray into another struct?
// Don't want pointer copy as it's not thread safe.
// Below is a very simple example.
- mBaseArray is populate in some fashion. Notice the use of polymorphism here.
... Some sync point here
... After this point, I want to copy the information that is in mBaseArray into Module2's mWorkingArray.
- Want to copy the data from mBaseArray into Module2's own array.
- Copied data from mBaseArray without the use of pointers. Want only data.
- Module2 contains a similar declaration to mBaseArray.
Is there a way to accomplish this? Or is there some other method that will solve this problem?
If there are better ways of doing what I'm trying to accomplish, I am more than welcome to suggestions.