Dec 31, 2015

[C++] friend rule for function & template function [NOTE]

If the name is not followed by angle brackets, there are two possibilities:


  • If the name isn't qualified (in other words, it doesn't contain a double colon), it never refers to a template instance. If no matching nontemplate function is visible at the point of the friend declaration, the friend declaration is the first declaration of that function. The declaration could also be a definition.
  • If the name is qualified (it contains ::), the name must refer to a previously declared function or function template. A matching function is preferred over a matching function template. However, such a friend declaration cannot be a definition.


No comments:

Post a Comment

Note: Only a member of this blog may post a comment.