Simple text menu in C++
问题 I am writing a silly little app in C++ to test one of my libraries. I would like the app to display a list of commands to the user, allow the user to type a command, and then execute the action associated with that command. Sounds simple enough. In C# I would end up writing a list/map of commands like so: class MenuItem { public MenuItem(string cmd, string desc, Action action) { Command = cmd; Description = desc; Action = action; } public string Command { get; private set; } public string