Hacker News new | past | comments | ask | show | jobs | submit login

I do C++ for almost 20 years but never came across this simple technique before, so I'm quite surprised that I actually like it.

I usually avoid 'friend' in these situations and just write

    //private:
before the method declaration. But it actually happened that co-workers used these private methods because they use code-completion instead of reading the header...

But I might would call the class Friend<T> or something.




> But it actually happened that co-workers used these private methods because they use code-completion instead of reading the header...

A nice feature I've noticed in Elixir is that giving a function a "@doc false" annotation will actually prevent IDE/REPL autocomplete from completing the function. (It's still there to call if you type it yourself.) Maybe that's something C++ tooling could copy.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: