hatcat / cg30_issues

The public issues repository for the book "Beautiful C++"
4 stars 1 forks source link

Dual interface inclarity #50

Open VictorEijkhout opened 1 year ago

VictorEijkhout commented 1 year ago

Page 153 "the public get_commander functions simple forward"

Have I mentioned how allergic I am to the word "simply" (or "just")? To me that's a signal that the writer is lazy, or even unclear on the topic themself. Since the latter is not the case, you reallyneed to waste more words on this.

First: do the work So I thought I'd give the soldier a private: commander _c and let the work be return _c.

Hah. Your function is static and can not return non-static member. So why is your function static?

Then: undefined soldier::get_commander Yes, I suspected that. What is the relation between your _impl function and the public functions? I would love to understand and use this idiom, but your example is insufficient for that.

Please clarify. In fact, please do so right here and now because this issue unlike my others is not purely academic.