title: What is the correct specialization for distinguishing between value template class and lvalue template class?
body: <p>I need to make a template specialization which distinguish between a template class with (only) value parameters like the following:</p>
  <pre><code>template&lt;auto ... __vz&gt;
  struct values{};
  </code></pre>
  <p>and a template class with (only) reference parameters like the following:</p>
  <pre><code>template&lt;auto&amp; ... __lvz&gt;
  struct lvalues{};
  </code></pre>
  <p>But with following specialization I was not successful:</p>
  <pre><code>template&lt;typename&gt;
  struct is_values{
      static constexpr bool value = false;
  };
  template&lt;template&lt;auto ...&gt;class __m, auto ... __vz&gt;
  struct is_values&lt;__m&lt;__vz ...&gt; &gt;{
      static constexpr bool value = true;
  };
  
  template&lt;typename&gt;
  struct is_lvalues{
      static constexpr bool value = false;
  };
  template&lt;template&lt;auto&amp; ...&gt;class __m, auto&amp; ... __vz&gt;
  struct is_lvalues&lt;__m&lt;__vz ...&gt; &gt;{
      static constexpr bool value = true;
  };
  </code></pre>
  <p>When they are tested like the following:</p>
  <pre><code>const int a = 1;
  const int b = 2;
  const int c = 3;
  
  int main()
  {
      std::cout &lt;&lt; is_values&lt;lvalues&lt;a,b,c&gt; &gt;::value &lt;&lt;std::endl; // wrong result
      std::cout &lt;&lt; is_lvalues&lt;values&lt;1,2,3&gt; &gt;::value &lt;&lt;std::endl; // causes error
  }
  </code></pre>
  <p>One of them gives a wrong result and one gives the following error:</p>
  <pre><code>test.cpp: In instantiation of ‘struct is_lvalues&lt;values&lt;1, 2, 3&gt; &gt;’:
  test.cpp:51:41:   required from here
  test.cpp:32:34: error: initializing ‘int&amp;’ with ‘int’ in converted constant expression does not bind directly
     32 | struct is_lvalues&lt;__m&lt;__vz ...&gt; &gt;{
        |                                  ^
  test.cpp:32:34: error: could not convert ‘1’ from ‘int’ to ‘int&amp;’
  test.cpp:32:34: error: initializing ‘int&amp;’ with ‘int’ in converted constant expression does not bind directly
  test.cpp:32:34: error: could not convert ‘2’ from ‘int’ to ‘int&amp;’
  test.cpp:32:34: error: initializing ‘int&amp;’ with ‘int’ in converted constant expression does not bind directly
  test.cpp:32:34: error: could not convert ‘3’ from ‘int’ to ‘int&amp;’
  test.cpp:33:24: error: initializing ‘int&amp;’ with ‘int’ in converted constant expression does not bind directly
     33 |  static constexpr bool value = true;
        |                        ^~~~~
  test.cpp:33:24: error: could not convert ‘1’ from ‘int’ to ‘int&amp;’
  test.cpp:33:24: error: initializing ‘int&amp;’ with ‘int’ in converted constant expression does not bind directly
  test.cpp:33:24: error: could not convert ‘2’ from ‘int’ to ‘int&amp;’
  test.cpp:33:24: error: initializing ‘int&amp;’ with ‘int’ in converted constant expression does not bind directly
  test.cpp:33:24: error: could not convert ‘3’ from ‘int’ to ‘int&amp;’
  test.cpp: In function ‘int main()’:
  test.cpp:51:43: error: ‘value’ is not a member of ‘is_lvalues&lt;values&lt;1, 2, 3&gt; &gt;’
     51 |  std::cout &lt;&lt; is_lvalues&lt;values&lt;1,2,3&gt; &gt;::value &lt;&lt;std::endl; // causes error
        |                                           ^~~~~
  make: *** [src/subdir.mk:20: src/test.o] Error 1
  &quot;make all&quot; terminated with exit code 2. Build might be incomplete.
  
  12:14:37 Build Failed. 14 errors, 0 warnings. (took 677ms)
  
  </code></pre>
  <p>So far I was only successful with the following specializations:</p>
  <pre><code>template&lt;auto ... __vz&gt;
  struct is_values&lt;values&lt;__vz ...&gt; &gt;{
      static constexpr bool value = true;
  };
  template&lt;auto&amp; ... __vz&gt;
  struct is_lvalues&lt;lvalues&lt;__vz ...&gt; &gt;{
      static constexpr bool value = true;
  };
  </code></pre>
  <p>But these are not desired because they only detect the types resulted from <code>values</code> and <code>lvalues</code> not any other similar template with different name.</p>
  <p>So what is the right specialization?</p>