Best practice for postfix ++ operator return type
I'm overloading operator++(int) and have a question about it's return type. At the moment I'm using a temporary variable inside the function that I return after *this has been incremented.
However, returning a copy wont work in chains, cout and so on, and returning a reference gives an error since the temp variable is local. I have solved this (for now) by declaring the temp variable static, it sort of feels like a hack, but is this ok? And if not how else can this be solved?