C++ Logo


Advanced search

Re: C++ 20. An explicit specialization of a template friend function with a default template argument.

From: Brian Bi <bbi5291_at_[hidden]>
Date: Wed, 28 Aug 2019 14:09:00 -0500
Hmm, I think that in most cases, you can solve this problem by declaring
the function template before or after the class definition, and putting the
default argument there rather than in the friend declaration. (Though one
can certainly think of rare situations where this would not do.)

On Wed, Aug 28, 2019 at 12:24 PM Vladimir Grigoriev via Std-Discussion <
std-discussion_at_[hidden]> wrote:

> In the C++ 20 Standard (13.1 Template parameters) there is written
> 11. .... If a friend function template declaration specifies a default
> template-argument, that declaration shall be a definition and shall be the
> only declaration of the function template in the translation unit.
> So what to do in this case when an explicit specialization of the function
> is required? The name of the template is not visible outside the class
> where it is defined.
> With best regards,
> Vlad from Moscow
> You can meet me at http://cpp.forum24.ru/ or www.stackoverflow.com or
> http://ru.stackoverflow.com
> --
> Std-Discussion mailing list
> Std-Discussion_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/std-discussion

*Brian Bi*

Received on 2019-08-28 14:11:17