typeinfo


1. Type Identification

#include <typeinfo>
class Animal { };
class Dog : public Animal { };
int main() {
  Animal* animal = new Dog;
  if (typeid(*animal) == typeid(Dog)) {
    cout << "animal is a Dog" << endl;
  }
  return 0;
}

2. Dynamic Cast

Animal* animal = new Dog;
Dog* dog = dynamic_cast<Dog*>(animal);
if (dog) {
  cout << "Animal is a Dog" << endl;
}

3. Type Comparison

#include <typeinfo>
if (typeid(int) == typeid(long)) {
  cout << "int and long are the same type" << endl;
}

4. Type Conversion

5. Type Erasure

6. Type Checking

7. Type Introspection

8. Type Manipulation

9. Type Information Retrieval

10. Type Metadata

11. Type Hierarchy

12. Run-Time Type Information (RTTI)

13. Object Factory

14. Variant Type

15. Template Metaprogramming

16. Type Aliasing

17. Type Deduction

18. Type Assertions

19. Type Conversion Operators

20. Type Deduction from Function Parameters

21. Type Deduction from Return Value

22. Type Deduction from Templates

23. Type Erasure in Containers