I have this function ( depending on some criteria id will have 1 or 2 )
1 2 3 4
my_function(int &id)
{ id=1
....
id=2 }
Ok, sometimes I want to call the function, but I have no interest in knowing the id value. How can I call the function ?
( I dont want to declare a garbage var ...)
Provide a parameterless overload that calls this one with a local.
But if you have a function that does something and returns something, and the thing it does is useful with or without the return value, it's a sign that the function is bloated and should be split up into smaller functions.
I reserve opinion as to what I like as a solution as the full details of the problem domain are not available to me; I only offer a posable solution for the OPs consideration.
_____
P.S. I take no offense :0)