This will be problematic in your use case: std::vector<MetricBasePointer> m_MetricVector;
. A smart pointer should be used so a reference is kept to the object. That is,
using MetricBasePointer = MetricBaseType::Pointer;
After fixing the issue identified above, what is the output of this?
The function has the same function signature for polymorphism.