Why is while's condition outside the do while scope
More often than not we need loops like this do { Type value(GetCurrentValue()); Process(value); }while(condition(value)); Unfortunately this will not compile, because value 's scope ends at } . Which means that I will have to declare it outside the loop. Type value; do { value = GetCurrentValue(); Process(value); }while(condition(value)); I don't like this for at least two reasons. For one, I like declaring things locally. And second, this is a problem if value is not assignable or default-constructible, but only copy-constructible. So, my question has two sides. First, I'd like to know if