(2.3) — define a member template of a class or class template, or
(2.3) — declare or define a member template of a class or class template, or
#include <iostream>
struct A
{
template <auto N>
static void f(); // template member declaration
};
template <auto N>
void A::f() { std::cout << N << '\n'; } // template member definition
int main()
{
A::f<10>();
A::f<'A'>();
}
No, it's correct as-is. This covers the case where there are multiple
nested template-heads, e.g.
template<class T>
template<class U>
void S<T>::f(U) { }
In such a case, the /declaration/
template<class U>
void S<T>::f(U) { }
must be a definition. (You can't just-declare member functions outside
of their class.)
Jens
On 28/05/2019 14.47, 'Vlad from Moscow' via ISO C++ Standard - Discussion wrote:
> In the C++ Standard 17 in the section 17 Templates (p. #2) there is written
>
> (2.3) — define a member template of a class or class template, or
>
>
> Should it be written instead?
>
> (2.3) — declare or define a member template of a class or class template, or
>
>
>
> --
>
> ---
> You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Discussion" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to std-dis...@isocpp.org <mailto:std-discussion+unsub...@isocpp.org>.
> > To unsubscribe from this group and stop receiving emails from it, send an email to std-dis...@isocpp.org <javascript:> <mailto:std-discussion+unsub...@isocpp.org <javascript:>>.
> > To view this discussion on the web visit https://groups.google.com/a/isocpp.org/d/msgid/std-discussion/9bd96841-9211-44f3-8272-8dd1ac63abdf%40isocpp.org <https://groups.google.com/a/isocpp.org/d/msgid/std-discussion/9bd96841-9211-44f3-8272-8dd1ac63abdf%40isocpp.org> <https://groups.google.com/a/isocpp.org/d/msgid/std-discussion/9bd96841-9211-44f3-8272-8dd1ac63abdf%40isocpp.org?utm_medium=email&utm_source=footer <https://groups.google.com/a/isocpp.org/d/msgid/std-discussion/9bd96841-9211-44f3-8272-8dd1ac63abdf%40isocpp.org?utm_medium=email&utm_source=footer>>.
>
> --
>
> ---
> You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Discussion" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to std-dis...@isocpp.org <mailto:std-discussion+unsub...@isocpp.org>.
(2.3) — declare or define a member template of a class or class template, or
> > To unsubscribe from this group and stop receiving emails from it, send an email to std-dis...@isocpp.org <javascript:> <mailto:std-discussion+unsub...@isocpp.org <javascript:>>.
> > To view this discussion on the web visit https://groups.google.com/a/isocpp.org/d/msgid/std-discussion/9bd96841-9211-44f3-8272-8dd1ac63abdf%40isocpp.org <https://groups.google.com/a/isocpp.org/d/msgid/std-discussion/9bd96841-9211-44f3-8272-8dd1ac63abdf%40isocpp.org> <https://groups.google.com/a/isocpp.org/d/msgid/std-discussion/9bd96841-9211-44f3-8272-8dd1ac63abdf%40isocpp.org?utm_medium=email&utm_source=footer <https://groups.google.com/a/isocpp.org/d/msgid/std-discussion/9bd96841-9211-44f3-8272-8dd1ac63abdf%40isocpp.org?utm_medium=email&utm_source=footer>>.
>
> --
>
> ---
> You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Discussion" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to std-dis...@isocpp.org <mailto:std-discussion+unsub...@isocpp.org>.