Hi Jim,
Sadly your idea doesn't work in C++, because C++ has member functions. That is, we can write things like this:
struct Widget {
void reset(); // reset the widget
};
[...]
std::unique_ptr<Widget> p = std::make_unique<Widget>();
p->reset(); // reset the pointed-to widget by calling Widget::reset() member function
p.reset(); // reset the pointer's own value to nullptr
But, isn't the .reset() implemented on the unique_ptr<> template as a operator. override? which takes precedence over the default behavior...
No, C++ doesn't permit overloading the "." operator at all.
It's just that `p.reset()` calls `unique_ptr<Widget>::reset`,
and `p->reset()` calls `unique_ptr<Widget>::operator->` followed by `Widget::reset`.
I think you'll have to learn more about how C++ currently works, before working on proposals to change it.
A appricate you leveraing my acknowledgment of limitation as a dismissal; it's more a factor that I need to learn the right way to say it.
It doesn't look like that's either a instance of a class/struct/union or a pointer to a class/struct/union, but rather is a unique pointer to a class/struct/union.
Also would have no effect on references... I would bet that the modification of the compiler to accomplish a compatible, non-breaking change is either a small addition to 'if left hand is a '*' pointer or a instance of a struct/class/union.
Because the cases that matter are all error cases now.