Checking for empty string in C++ alternatives : <p>There are (at least :) two ways of checking if an string is empty in C++, in particular:</p>

<pre><code>if (s.length() == 0) {
  // string is empty
}
</code></pre>

<p>and</p>

<pre><code>if (s == "") {
  // string is empty
}
</code></pre>

<p>Which one is the best from a performance point of view? Maybe the library implementation is clever enough so there isn't any different between them (in which case other criteria should decide, i.e. readibility) but I tend to think that the first alternative (using <code>length()</code>) is better.</p>

<p>Any feedback on this, please? (Or even a 3rd method better than the ones I have proposed).</p>
