title: How remove NAN from C++ vector?
body: <p>I have </p>
  
  <pre><code>std::vector&lt;double&gt;x={1,2,NAN,3, NAN, 4}
  </code></pre>
  
  <p>when I try <code>x.erase(remove(x.begin(), x.end(), NAN), x.end()</code>, I still see <code>NAN</code> as</p>
  
  <pre><code>for (auto i:x)
      std::cout&lt;&lt;i&lt;&lt;" ";
  </code></pre>
  
  <p>gives</p>
  
  <pre><code>1 2 -nan(ind) 3 -nan(ind) 4
  </code></pre>
  
  <p>how can I remove the NANs so the output is below?</p>
  
  <pre><code>1 2 3 4
  </code></pre>
  
  <p>EDIT: <code>x</code> is a vector of doubles, not ints</p>