Passing value++ as a reference is almost certainly undefined behaviour.  - the increment could happen before or after the function is called.

You need to pass value, and have the function increment it as needed