lundi 14 décembre 2020

When binding constructor getting an error: missing 'typename' prior to dependent type name in C++

How to bind a constructor in C++?

In one class, I have template class with constructor like as shown below:

namespace EMRProcess
{
template<typename T>
    class CEMRImpl
    {

CEMRImpl(EMRProcessSR::CWebHandler<T>*  pHandler_, 
                            CSocketRemover* pSocketRemover, const std::string& strID, const std::string& strNo);

};
}

From another class, I am trying to bind the constructor like as shown below:

m_pMyObj->processEvent(EVT_MED, strTestId,
                                           std::bind(&EMRProcess::CEMRImpl<T>::CEMRImpl,
                                                     this,
                                                     this,
                                                     strID,
                                                     strNo));

When compiling i am getting an error: missing 'typename' prior to dependent type name 'EMRProcess::CEMRImpl::CEMRImpl'

Could someone please help me on this?

Aucun commentaire:

Enregistrer un commentaire