title: How to deal with template const and non-const parameters?
body: <p>I have a Template function taking in const types such as:</p>
  <pre><code>template &lt;class T, class U&gt;
      void process(const T&amp; v1, const U&amp; v2)
      {
        //do some things
        verify(v1);
        verify(v2);
      }
  </code></pre>
  <p>Then the verify function checks the Type for T using if constexpr as follows:
  (The function also returns the variable. I set it to auto for the purpose of this question)</p>
  <pre><code>template &lt;class T&gt;
      auto verify(const T&amp; t)
      {
        if constexpr (is_same_v&lt;T, int&gt;)
            return t;
        if constexpr (is_same_v&lt;T, string&gt;)
            return t;
        if constexpr (is_same_v&lt;T, double*&gt;)
            return t;
        else
            static_assert(false, &quot;Type not allowed&quot;);
      }
  </code></pre>
  <p>if the type is not found it will trigger a compilation error.
  This all works very fine but the problem is I would like to make v2 a non-const U&amp; parameter. This triggers the static_assert and I don't know why. I also set all parameters in both functions to non-const but I still get the same error. All I really want is to pass the arguments by reference. Can anyone give me some hints? Thanks in advance.</p>