I have a class:
//header file
class CMDatabase
{
class Try;
typedef boost::shared_ptr<Try> TryPtr;
typedef boost::ptr_vector<Try> 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<ServiceDataImpl> ServiceDataImplPtr;
//const ServiceDataImplPtr pOtherData = dynamic_cast<const ServiceDataImplPtr>(mySd);
//ServiceDataImpl *pOtherData = dynamic_cast<ServiceDataImpl *>(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(&CMDatabase::Try::equal), *i));
}
}
When I compile this, I get error:
Error 1 error C2440: 'initializing' :
cannot convert from 'const CMDatabase::Try' to 'CMDatabase::Try
*' c:\program files\microsoft visual studio 9.0\vc\include\functional 296
Can anyone pelase tell me what is it that I am doing wrong and how to correct it.