Is it possible to write a function that takes a type and returns a (related) type. For instance, a function which take a type called “RandomVariable” and return a type called “RandomVariableCovariance”. I guess in general the question is whether typenames can be parameters or return types. C++0x is fine.
Share
You can’t do it with functions, but you can do it with template specialisations. For example
Defines a type
ConvertTypewhich is specialised to convert fromRandomVariabletoRandomVariableCovariance. Its possible to do all kinds of clever type selection this way depending on what you need.