I need to access type information from a class I used to instantiate another class.
Specifically void Beta<T>::do_something()
needs to accept parameters of type W, S
that were used to instantiate class Alpha<W, S>
.
template<typename W, S>
class Alpha {
public:
using carry_W = W;
using carry_S = S;
};
template<typename T>
class Beta {};
template<typename T>
void Beta<T>::do_something(typename T::carry_W p1, typename T::carry_S p2) {}
Beta<Alpha<int, double>> b;
The solution above works fine but is there any other way to do this without aliasing the types as class members? Is there a more "C++" way of doing this?