Hi,
I'd like to suggest an edit to [temp.friend] to make the standard more clear in a use case I ran into recently. I'm writing to get feedback. The use case is as follows; Suppose we have a template class
<template class T>
profile_integer;
This might be a arithmetic type for which we want to overload operators for common types; and so in the definition we wish to have
<template class V>
friend profile_integer<T> operator*(const V& lhs, const profile_integer<T>& rhs);
and we wish to define this out of line. This (and correct me here) is impossible. When we instantiate profile_integer<T> for some concrete type T we create a friend declaration for operator*<V> but any out of line definition would be for operator*<T, V> and these are two different functions. In practice this compiles but fails to link for lack of operator*<V>.
I think adding to the example in [temp.friend] (1) Example 1 that makes it clear that this must be an inline definition and a note in the text below would make sense.
While all the elements to explain the above behavior exist in the standard, to a casual reader of the standard it may not be abundantly clear and a casual reading of the one example of a template friend of a template class may suggest that an out of line definition is possible (it's possible if the function signature doesn't depend on the class template type.)
If my understanding is correct and this makes sense I believe it would fall under an editorial issue and a PR in git would be appropriate, is that correct?
Of course I would appreciate it if the standard could support such an out of line definition of such a function but I suspect that is non-trivial. Please correct me here if I'm wrong.
--
Mike