How to check if a string contains spaces/tabs/new lines (anything that's blank)?
<p>I know there's an "isspace" function that checks for spaces, but that would require me to iterate through every character in the string, which can be bad on performance since this would be called a lot. Is there a fast way to check if a std::string contains only spaces?</p>

<p>ex: </p>

<pre><code>function("       ") // returns true
function("    4  ") // returns false
</code></pre>

<p>One solution I've thought of is to use regex, then i'll know that it only contains whitespace if it's false... but i'm not sure if this would be more efficient than the isspace function.</p>

<pre><code>regex: [\w\W] //checks for any word character(a,b,c..) and non-word character([,],..)
</code></pre>

<p>thanks in advance!</p>
