Implementing a State Machine in C++
Implementing a state machine in C++ can seem daunting, but with C++11’s features, we can build one in under 100 lines of code. In this article, I’ll walk you through three implementations of a state machine, each with increasing complexity, and show you how to use them with simple examples. You can find the full source code on GitHub. What is a state machine? A state machine is a computational model used to design systems that can be in one of a finite number of states at any given time....