3 ms·
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
by kyllo 13y ago
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-used-to-implement-undo-and-redo-option http://stackoverflow.com/questions/701131/data-structure-use...
- deleted 13y ago[deleted]