I don't see how this could be specified, since the template parameters could no longer be deduced.

-------- Original message --------
From: Andrew Schepler via Std-Discussion <std-discussion@lists.isocpp.org>
Date: 9/28/19 10:24 (GMT-05:00)
To: std-discussion@lists.isocpp.org
Cc: Andrew Schepler <aschepler@gmail.com>
Subject: Re: [std-discussion] Partial specialization with only one template parameter in the primary template.

Not sure I understand. When you want to define one specific specialization like A<10>, that's what an explicit specialization is for. A partial specialization is useful when you want to define the template for some larger subset of the possible template arguments.

Though C++20's constraints and concepts will actually make it possible to do partial specializations of a template like your A (without changing A to add another dummy template parameter, like the "template <int N, typename Enable=void>" technique). For example, to define A for all argument values 10 or larger:

namespace N {
template <int N> requires (N >= 10)
struct A<N> {
  A() { std::cout << "A<N>() [N>=10]\n\n"; }

On Sat, Sep 28, 2019, 9:29 AM Vladimir Grigoriev via Std-Discussion <std-discussion@lists.isocpp.org> wrote:
In the Standard in teh section devoted partial specialization there is nothing said about cases when a primary template has only one template parameter. In this case sometimes it is impossible to declare a partial specialization and instead of a partial specialization we have an explicit specialization.

For example

#include <iostream>

namespace N
template <int>
struct A
A() { std::cout << "A<int>()\n" << '\n'; }

using N::A;

namespace N
template <>
struct A<10>
A() { std::cout << "A<10>()\n" << '\n'; }

int main()
A<1> a1;
A<10> a2;

How to define a partial specialization for template argument 10?

So I think the description of the section should point out such cases. 

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