Pretend I have a std::vector<vtkSmartPointer<vtkProp>> things;
I populate it with a number of different types (all derived from vtkProp
). For example, let’s say one item is a vtkAssembly
and one is a vtkActor
. Now I want to copy that collection of things
.
As I read the signature of ShallowCopy()
, I already have to know the most derived type of the thing I’m copying in order to copy it without slicing. For example, if I had a vtkSmartPointer<vtkProp3D> target
, I’d be able to successfully copy either vector entry into target
, having sliced away all of the vtkActor
or vtkAssembly
related data.
So, two-ish questions:
- Have I read that correctly?
- If so, how do I find the most derived type so that I can copy into a new instance of that type?
- (Or am I trying to solve the problem in completely the wrong way and there is some virtual method that clones the whole thing and returns something like a
vtkProp
?)