Set pointer to null
<p>I my c++ application I created some pointers to objects and added them to two vectors. Then I iterate through one vector till I  found a object which satisfy a desired condition. If it satisfied I want to NULL that pointer. The main thing is I want to make it to NULL at all places.  The sample code is as below. </p>

<pre><code>   #include &lt;vector&gt;

class Circle
{
public:
    Circle(int _iArea){iArea = _iArea;};
    ~Circle(){};
    void SetArea(int _iArea){ iArea = _iArea;};
    int GetArea(){return iArea;};

private:
    int iArea;
};

int _tmain(int argc, _TCHAR* argv[])
{
    Circle* pCircle1 = new Circle(10);
    Circle* pCircle2 = new Circle(20);
    Circle* pCircle3 = new Circle(30);
    Circle* pCircle4 = new Circle(40);


    std::vector&lt;Circle*&gt;vector_test1;
    vector_test1.push_back(pCircle1);
    vector_test1.push_back(pCircle2);
    vector_test1.push_back(pCircle3);
    vector_test1.push_back(pCircle4);

    std::vector&lt;Circle*&gt;vector_test2;
    vector_test2.push_back(pCircle1);
    vector_test2.push_back(pCircle2);
    vector_test2.push_back(pCircle3);
    vector_test2.push_back(pCircle4);

    std::vector&lt;Circle*&gt;::iterator itrVecTest1 = vector_test1.begin();
    std::vector&lt;Circle*&gt;::iterator itrVecTest1End = vector_test1.end();
    while(itrVecTest1 != itrVecTest1End)
    {
        int iType = (*itrVecTest1)-&gt;GetArea();
        if(iType ==10)
        {
            delete (*itrVecTest1);
            *itrVecTest1 = NULL;
        }
        ++itrVecTest1;
    }
    retrun 0;
}
</code></pre>

<p>Here pCircle1 satisfy the given condition and I want to delte it from all the places. Using this code I can make the pointer in the vector_test1 to null. But is there a way to make the set the same pointer in the vector_test2 at the same time without iterate through it? </p>
