Language Features

Runtime Polymorphism with std::variant and std::visit

Illustrated by Julia Hanke

Presenting a new technique to implement runtime polymorphism. Take a journey as we play with std::variant to make it possible to have heterogeneous collections and call functions in a way similar to virtual functions. But is std::variant-based polymorphism better "virtual" polymorphism? That is the question.

To continue reading


  • Access to original high quality content
  • Priority support and feedback
  • A thank you for supporting our small independant publication

Already purchased issue? Login