Talk:Barton–Nackman trick/Archive 1

Note for editors
I saw that this article has been discussed at the following Google Groups thread. (If that link goes dead, search for a thread entitled "How to fix a program that depends on friend injection?" that began on March 11 2007). Note that at one time this article depended on information in Vandevoorde and Josuttis. David himself has edited this article to reflect that the book was slightly incorrect with respect to function template overloading (and noted that he had in the thread mentioned). Given all this, I ask future editors to be particularly careful to not inadvertedly re-introduce mistakes that have been corrected. Many thanks, Pcb21 Pete 09:40, 14 March 2007 (UTC)


 * I think we should add this note as a comment, to make sure anyone attempting to edit the article will see it. I'd expect a correction to be posted in reasonable time on the book errata, since David kindly forwarded a note to Nicolai, who maintains the errata page. When that will happen, we can change that comment to something like "note: see errata at http://... etc. etc." &mdash; Gennaro Prota &#8226;Talk 08:23, 17 March 2007 (UTC)


 * FYI, I do have saved copies of this thread. But it's in the Wayback Machine, too :-) = paul2520 (talk) 23:03, 28 December 2019 (UTC)

Proposal mistake
The proposal that is intended to "obsolete" the barton & nackman trick actually talks about the idiom Curiously Recurring Template Pattern (which concepts indeed declare obsolete then), even though it claims talking about the Barton & Nackman trick. I believe it confuses these two concepts.

As explained in the article, this is confused often. But as this is a link to a more or less official document containing this confusion, i will not remove that link from the article, but rather ask you what to do about it. —Preceding unsigned comment added by 84.174.239.213 (talk) 07:14, 20 May 2009 (UTC)

What is achieved?
The article mentions that template overloading is not a problem anymore. So when and why would I use this trick nowadays? What can be achieved that can't be done by just writing free template functions? Would like to see an example here. 84.245.149.53 (talk) 10:25, 12 January 2016 (UTC)

friendly access yet still public
bool equal_to(value_type const& rhs) const; is a public function. There is no explanation why this is (and has to be) a public function when called by the friend function, when friend functions are supposed to be able to access private functions. QuentinUK (talk) 15:47, 22 May 2016 (UTC)

I have a similar question. Could this be a typo? It would make more sense to me to make equal_to private, and inherit publicly (so that == and != operators can be used outside the class):