Re:Should "Yes, delete it" be red, or green?
by kyllo on Thursday March 27, 2014 @12:56AM
(#7478686)
Another standard way is with the command pattern, and using one "undo" stack, with another "redo stack". When you perform a command, a command object is pushed onto the "undo" stack. When you undo a command, it's popped off the stack, its undo() method is called, and it's pushed onto the "redo" stack. When you redo a command, it's popped off the redo stack, and executed. When you execute a new command (not an undo or redo) you push it onto the undo stack and clear out the redo stack.
See this SO question for further detail and links: http://stackoverflow.com/questions/701131/data-structure-use...