CPP: Dynamicly change a typedef in a Class wothout using inheritance?

Viewed 69

So I am trying to extend a software. Now the software has a central DataStorage class which uses typedefs and dependent on that some set and get funcitons. Now with my extension the following typedef is not always right:

typedef Eigen::Matrix<unsigned char, Eigen::Dynamic, Eigen::Dynamic> eType;

Dependent on the argument that is passed before running the software, I would no need to change it to :

typedef Eigen::Matrix<float, Eigen::Dynamic, Eigen::Dynamic> eType;
  1. Now I thought about deriving an alternative class from the class, but that dataContainer is used at so many places, that it would be difficult to keep track and change where it would be needed.
  2. Dynamically changing the typedef dependend on the passed argument is not possible right?
  3. Using auto as a scalar type in Eigen is also not possible?

Is there any easy way to solve this? I am really trying to avoid to derive a new Class from it, since the function of the DataStorage are used everywhere in the code and some classes have that class as a member which also could make errors.

0 Answers
Related