Passing a const vector<pointers> to a method but changing value pointed to
<p>I have following code (only relevant portions shown for sake of brevity - please let me know if I have been too brief):</p>

<pre><code>class my_class
{
    public:
    my_class() {m_i=0;}
    set(int i) {m_i = i;}
    private:
    int m_i;
}

void CallMod()
{
    // create a bunch of my_class* o = new my_class() and store in vector&lt;my_class*&gt; 
    // vObject (left out for brevity)
    Mod(vObject);
    // will vObject contain pointers to objects that have m_i == 2
}

void Mod(vector&lt;my_class*&gt; const &amp; vObject)
{
    BOOST_FOREACH(my_class o, vObject)
    {
        o-&gt;set(2);
    }
}
</code></pre>

<p>Does this mean that while vObject is const, the modification done by the call to o->set(2) will be retained once Mod returns? Does that indicate that the "const" qualifier will not allow modify operations on vObject (i.e. the vector) but allows modification on the contained pointers to my_class?</p>

<p>Did I understand this right? Any duplicate questions that answers this - I couldn't find one - links most appreciated.</p>
