In C++, we can declare variables directly in the if statement and its value is used as the condition, e.g.
if (SubClass *subObject = dynamic_cast<SubClass *>(baseObject)) {
// ...
}
For some reason, I always assumed that this was a "relatively" new feature, introduced in C++11 at the earliest, but when I tried to confirm this, I found no information about this, only that C++17 expands the syntax even further. When I tried compiling a minimal example with -std=c++98, it worked. So has this been a feature of C++ from the beginning?