title: Template friendly string to numeric in C++
body: <p>In C++ standard library there are functions to convert from string to numeric types:</p>
  
  <pre><code>stoi
  stol
  stoll
  stoul
  stoull
  stof
  stod
  stold
  </code></pre>
  
  <p>but I find it tedious to use them in template code. Why there are no template functions something like:</p>
  
  <pre><code>template&lt;typename T&gt;
  T sto(...)
  </code></pre>
  
  <p>to convert strings to numeric types?</p>
  
  <p>I don't see any technical reason to not have them, but maybe I'm missing something. They can be specialised to call the underlying named functions and use <code>enable_if</code>/<code>concepts</code> to disable non numeric types.</p>
  
  <p>Are there any template friendly alternatives in the standard library to convert string to numeric types and the other way around in an efficient way? </p>