In my last article, we discussed Finite State Machines based on std::variant and some cool C++17 techniques. Today I want to go further and show you an example of a Vending Machine implementation.
By Bartlomiej Filipek
From the article:
Here’s a basic diagram that illustrates how the machine is going to work:
Following the model from the last article, each state and the event will be a separate small structure. Later we can “pack” them into std::variant.