title: remove_if: Predicate error when passing a function returning bool
body: <p>I have this pre-defined function.</p>
  
  <pre><code>void attack(std::vector&lt;GameObject*&gt; objects, unsigned damage) {
  
  
      for (GameObject* object : objects) {
          object-&gt;takeDamage(damage);
          auto isDead = object-&gt;isDead();
          objects.erase(std::remove_if(objects.begin(),objects.end(),isDead), objects.end());
      }
  }
  </code></pre>
  
  <p>This is my isDead function</p>
  
  <pre><code>bool isDead() const { 
      if (destructed) { 
              std::cout &lt;&lt; "memory error" &lt;&lt; std::endl; 
          } 
  
      return life &lt;= 0; 
  }
  </code></pre>
  
  <p>This is the error I keep getting. Have tried a lot of things, but not at all able to figure this one out. Any help appreciated!</p>
  
  <p><strong>error: expression cannot be used as a function
    { return bool(_M_pred(*__it)); }</strong></p>