title: boost::ptr_vector and find_if
body: <p>I have a class:</p>
  
  <pre><code>//header file
  class CMDatabase
  {
      class Try;
      typedef boost::shared_ptr&lt;Try&gt; TryPtr;
      typedef boost::ptr_vector&lt;Try&gt; TryVector;
      typedef TryVector::iterator TryVectorIterator;
  
      class Try
      {
          public:
              virtual ~Try();
              virtual bool equal(CMDatabase::TryPtr mySd) = 0;
      };
  };
  
  //.cpp file
  
  class TryImpl : public CMDatabase::Try
  {
      bool equal(CMDatabase::TryPtr mySd)
      {
          //boost::shared_ptr&lt;ServiceDataImpl&gt; ServiceDataImplPtr;
          //const ServiceDataImplPtr pOtherData = dynamic_cast&lt;const ServiceDataImplPtr&gt;(mySd);
  
          //ServiceDataImpl *pOtherData = dynamic_cast&lt;ServiceDataImpl *&gt;(mySd.get());
          return true;
      }
  };
  
  //Another .cpp file
  
  void UpdateClass::TryFind()
  {
      CMDatabase::TryVector defaultTry;
      CMDatabase::TryVector updateTry;
  
  //Code for filling two vectors here....
  
      for(CMDatabase::TryVectorIterator i = defaultTry.begin(); i != defaultTry.end(); ++i)
      {
         CMDatabase::TryVectorIterator it = find_if(updateTry.begin(), updateTry.end(),bind1st(mem_fun(&amp;CMDatabase::Try::equal), *i));
  
      }
  }
  </code></pre>
  
  <p>When I compile this, I get error:</p>
  
  <blockquote>
    <p>Error 1   error C2440: 'initializing' :<br>
    cannot convert from 'const CMDatabase::Try' to 'CMDatabase::Try<br>
    *'    c:\program files\microsoft visual studio 9.0\vc\include\functional  296</p>
  </blockquote>
  
  <p>Can anyone pelase tell me what is it that I am doing wrong and how to correct it.</p>