with
keyword in Pascal can be use to quick access the field of a record.
Anybody knows if C++ has anything similar to that?
Ex: I have a pointer with many fields and i don't want to type like this:
if (pointer->field1) && (pointer->field2) && ... (pointer->fieldn)
what I really want is something like this in C++:
with (pointer)
{
if (field1) && (field2) && .......(fieldn)
}
In C++, you can put code in a method of the class being reference by pointer
. There you can directly reference the members without using the pointer. Make it inline
and you pretty much get what you want.