Michiel Helvensteijn wrote: > JPF wrote: > >> There's at least one more solution: >> define the property as >> -------------------------------------------------- >>>> bool empty { >>>> void set(auto value) { ... } >>>> auto get() { ... } >>>> } >> -------------------------------------------------- >> but rewrite empty.get/set to empty.__get/__set. As far as I know names >> beginning with __ are reserved, so the returned type of the property >> couldn't define it. > > This may be acceptable. I don't much like that the double-underscore is > necessary, but it may be the best solution there is. > >> auto getter = &empty.__get() > > You meant without the parentheses here, right?
sure (damn copy & paste) ;-) >> As an addition >> -------------------------------------------------- >> auto b = &empty >> -------------------------------------------------- >> would then return a pointer to the returned value. > > That would be a pointer to a temporary value, though. Not very useful. But > lexically, it works, yes. > It was mentioned in another thread, that's why I mentioned it as well.