title: Use type of a variable as a template argument
body: <p>I did the following:</p>
  
  <pre><code>long long int x = 0;
  int digits_of_x = std::numeric_limits&lt;long long int&gt;::digits;
  </code></pre>
  
  <p>And it works fine. However this can easily introduce an error if someone changes the type of <code>x</code>. So I would prefer to do it like this:</p>
  
  <pre><code>long long int x = 0;
  int digits_of_x = std::numeric_limits&lt;typeof(x)&gt;::digits;
  </code></pre>
  
  <p>I found the GCC extension <code>typeof()</code> but I want to use some standard function (up to C++17). Is there such a function?</p>