title: How to check if char* p reached end of a C string?
body: <pre><code>template&lt;class IntType&gt;
  IntType atoi_unsafe(const char* source)
  {
      IntType result = IntType();
      while (source)
      {
          auto t = *source;
          result *= 10;
          result += (*source - 48);
          ++source;
      }
      return result;
  }
  </code></pre>
  
  <p>and in <code>main()</code> I have:</p>
  
  <pre><code>char* number = "14256";
  atoi_unsafe&lt;unsigned&gt;(number);
  </code></pre>
  
  <p>but the condition <code>while (source)</code> does not seem to recognize that <code>source</code> has iterated over the entire C string. How should it correctly check for the end of the string?</p>