title: How to filter characters from a string with C++/Boost
body: <p>This seems like such a basic question, so I apologize if it's already been answered somewhere (my searching didn't turn up anything).</p>
  
  <p>I just want to filter a string object so that it contains only alphanumeric and space characters.</p>
  
  <p>Here's what I tried:</p>
  
  <pre><code>#include "boost/algorithm/string/erase.hpp"
  #include "boost/algorithm/string/classification.hpp"
  
  std::wstring oldStr = "Bla=bla =&amp;*\nSampleSampleSample ";
  std::wstring newStr = boost::erase_all_copy(oldStr, !(boost::is_alnum() || 
                                                        boost::is_space()));
  </code></pre>
  
  <p>But the compiler is not at all happy with that -- it seems that I can only put a string in the second argument of <code>erase_all_copy</code> and not this <code>is_alnum()</code> stuff.</p>
  
  <p>Is there some obvious solution I'm missing here?</p>