title: erase-remove idiom problems for vector in a class
body: <p>I am using class1 that contains a few governing variables and a vector of another class, class2. I would like to be able to flag various elements of the vector of class2 (using boolean variable 'delete_me') and then run the erase-remove idiom to eliminate those elements from the vector. I have found some examples of this on the web, but these are for simpler data structures than what I am using. </p>
  
  <p>I am getting a type conversion error when I compile (using g++ v4.7.3).</p>
  
  <p>Class2:</p>
  
  <pre><code>class Interval_structure {
     //class uses default destructor
     public:
        float x1, x2, y1, y2;
        float A; 
        float B; 
        float delta_x; 
        bool delete_me;
  etc...
  </code></pre>
  
  <p>Class 1:</p>
  
  <pre><code>class CMR_Spline {
     //class uses default destructor
     public:
        vector&lt; Interval_structure &gt; Interval;
        int some_ints; 
        float some_floats;
  
    bool IsMarkedToDelete( Interval_structure&amp; o )
    {
        return o.delete_me;
    }
  
    void prune_Intervals() {
    //intervals that have been slated for deletion are removed using the remove-erase idiom
       Interval.erase( remove_if(Interval.begin(), Interval.end(), IsMarkedToDelete ), Interval.end() );
  
    }
  </code></pre>
  
  <p>When I compile I get the following error, cited for the single line in the prune_Intervals routine using erase+remove_if:</p>
  
  <blockquote>
    <p>error: cannot convert <code>CMR_Spline::IsMarkedToDelete' from type</code>bool (CMR_Spline::)(Interval_structure&amp;) ' to type `bool (CMR_Spline::*)(Interval_structure&amp;)'</p>
  </blockquote>
  
  <p>I'm a little confused as to how I should write the IsMarkedToDelete function and prune_Intervals routine to correctly reflect the pointer that is used by remove-if to traverse the vector and evaluate IsMarkedToDelete.</p>
  
  <p>How do I do this correctly using erase+remove_if, or if not that way please suggest an alternative approach. I am stumped and hindered by my limited programming experience. Thanks!</p>