Allows to perform a foreach operation from the head of the stack (the next item to be poped) to the tail of the stack (the very first item pushed).
The foreach process is non intrusive: it doesn't perform any change of the stack, but allows to traverse all items in the natural order in which items are stored (push) and removed (pop).
The function provided to perform the foreach operation will be called providing the stack data found, and the two user defined pointers provided.
- Parameters:
-
| stack | The stack where the foreach operation will be performed. |
| func | The foreach function to be called for each item found in the stack. |
| user_data | User defined pointer to be passed to the function provided. |
| user_data2 | User defined pointer to be passed to the function provided. |
- Returns:
- true if the foreach process was performed completely through all items inside the stack or false if not. The function will also return false to indicate a failure the stack and func parameters are null.