So I have these classes:
class Base {
};
template <typename T>
class Derived<T>: public Base {
};
class util {
public:
template <typename T>
void add(Derived<T> arg) {
vec.push_back(arg);
}
void start() {
//cast back down to Derived<T>
}
private:
std::vector<Base> vec;
};
In start()
I want to cast it back down to Derived<T>
but since the T can be anything, I can't cast it without the type. I'm wondering if there was to store the first element of vec's type information in like a typedef
or something so that I can use that in start()