About iterator and const problem in C++
<pre><code>class LogManager {
  private:
    mutable mapManagerMutex mapMutex;

    typedef std::map&lt;std::string, LogStorage*&gt; FileNameToStorageClass;
    FileNameToStorageClass  m_mapFileNameToLogStrg;

  public:
    int write( const string&amp; strFileName, char* text ) const;

};

int LogManager::write( const string &amp;strFileName, char* text ) const
{
   mapManagerMutex::scoped_lock lock(mapMutex);
   FileNameToStorageClass::iterator iter;
   iter = m_mapFileNameToLogStrg.find(strFileName);
   if(iter != m_mapFileNameToLogStrg.end())
   {
     // do some thing.
   }
   else
   {
     return -1;
   }
   return 0;
}
</code></pre>

<p>Above code compiles if i don't have const at end of write function. If i add const at end i am getting following error</p>

<pre><code>D:/LogManager.cpp:133: error: no match for 'operator=' in 'iter = ((const RtsInfrastructure::RtsCommon::Diagnostics::LogManager*)this)-
cc: C:/QNX650/host/win32/x86/usr/lib/gcc/i486-pc-nto-qnx6.5.0/4.4.2/cc1plus caught signal 1
</code></pre>

<p>Does any body know why we are seeing this?</p>
