Is it possible to declare a function in such a way that
auto i = foo.GetLock();
works, but
foo.GetLock();
causes a compile error?
My interface has a method that returns RIIA-style lock object and I want to make sure nobody decides just calling GetLock() locks the lock.
It used to be something like this
class CSomethingOrElse : private CLockable
{
...
} foo;
CLocker<CSomethingOrElse> lock(foo);
but it's too verbose for my taste and I would really like to make use of auto
.