Skip to content

Latest commit

 

History

History
16 lines (11 loc) · 358 Bytes

README.md

File metadata and controls

16 lines (11 loc) · 358 Bytes

Variants

Here we explore:

  • how std::variant offers an alternative to inheritance.

Prerequisites

  • slides about std::variant
  • slides about lambda functions (for solution2)

Instructions

In the file variant.cpp, replace inheritance with the use of a std::variant. Two solutions are provided :

  1. with std::get_if,
  2. with std::visit.