The Use Case

The lesson provides the implementation of a particular use case of std::variant and std::optional

​Consider a function that takes the current mouse selection for a game. The function scans the selected range and computes several outputs:

  • the number of animating objects
  • if there are any civil units in the selection
  • if there are any combat units in the selection

The existing code looks like this:

Get hands-on with 1400+ tech skills courses.