Hi guys,
Assuming I have a list of pointers to a generic type T:
1 2 3 4
#include <vector>
//...
list<T*> myList;
Now assuming I want to go on the list, and if T's type is matched to the type I'm looking for, then cast it to this type and do something. List shown here:
1. For pointers and other small/primitive types, use std::vector, not std::list - the performance gain is huge.
2. Make sure you have RTTI enabled.
3. Compare typeid(**iter) == typeide(Something) or use this idiom: