I think this belongs as a project-specific coding guideline (dont use implicit member name lookup), and then enforced with a linting tool and IDE modifications. It would be a strange use case to select this guideline on a per-class basis with syntax. This would be a project-wide decision.
Sometimes when I'm reading through another person's implementation of
a class, I see function calls inside member functions:
void SomeClass::SomeFunc(void)
{
SomeOtherFunc();
}
When I first see this code, I don't know if SomeOtherFunc is a member
function, or whether it's a member datum (i.e. a function pointer), or
whether it's a global function.
When I write the implementation of my own classes, I tend to like to
be specific:
void SomeClass::SomeFunc(void)
{
this->SomeOtherFunc();
}
I was thinking it would be good if we could mark a class, or perhaps
mark a member function, as "explicit this", as follows:
class SomeClass : explicit this {
void (*SomeOtherFunc)(void);
void SomeFunc(void)
{
SomeOtherFunc(); /* compiler error */
}
};
--
Std-Proposals mailing list
Std-Proposals@lists.isocpp.org
https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals