I created a recursive function in c++ and I want that after executing all recursive calls when I return to the first recursive call of my function then only I execute a specific statement which is inside the function. Basically, I want some mechanism by which I can execute a statement only once but when the control returns to the first recursive call. I tried static but it actually creates a single copy for all recursive function so each time the control encounter that specific line in my code it get changed and I don't want that. I want it once but when the control returns to the first recursive call.
Is there any keyword or mechanism to handle this behavior or I have to do this only via some conditional logic?