title: Strange const_iterator behavior
body: <p>I'm doing a main.cpp to test my implementation of a sparse matrix, where I create two const_iterators:</p>
  
  <pre><code>SparseMatrix&lt;double&gt;::const_iterator a,b;
  a=mata.begin(); //mata previously created as SparseMatrix&lt;double&gt;
  b=mata.end();
  ... //code goes on
  </code></pre>
  
  <p>The problem is that it doesn't call begin and end (it doesn't even do the initial cout), but if I create two iterators it works.
  Here's how I implemented begin and end for const_iterators. </p>
  
  <pre><code>const_iterator begin() const
  {
      cout&lt;&lt;"Begin"&lt;&lt;endl;
      int minr=minRow();
      int minc=minCol(findRow(minr));
      mcol * mc=findCol(findRow(minr),minc);
      const_iterator x;
      if(mc!=NULL)
      {
          T* dato=&amp;(mc-&gt;data);
          x= const_iterator(genElement(minr,minc,dato));
      }
      else
      {
          x=const_iterator(NULL);
      }
      x.setSM(const_cast&lt;SparseMatrix&lt;T&gt;*&gt;(this));
      return x;
  }
  
  const_iterator end() const
  {
      cout&lt;&lt;"End"&lt;&lt;endl;
      const_iterator x= const_iterator(NULL);
      x.setSM(const_cast&lt;SparseMatrix&lt;T&gt;*&gt;(this));
      return x;
  }
  </code></pre>
  
  <p>A strange thing I noticed is that if I create two const_iterators inside a SparseMatrix's class method, they work.</p>