You also have a default copy constructor, assignment operator and destructor. You could do this if you wanted.
Code:
Counter temp(*this);
...
*this = temp;
Note also that temp in this case is simply a variable that you don't plan to use for very long, thats not a temporary. A temporary usually refers to an unnamed variable that the compiler creates and that often dies at the first ';'
Code:
std::ostream & center(const std::string &s, int cols = 80, std::ostream &os=std::cout) {
int spaces = (cols-s.length())/2;
if(spaces > 0) os << std::string(spaces,' ');
return os << s;
}
...
center("Literal String");
This creates a bunch of tempraries. A temporary std::string is created when we call center with the literal string, a temporary is created for cols-s.length(), and temporary is created when we create the string of spaces. The int "spaces" on the other hand, is just a variable I don't use for very long.