I try to pass to function template from other object the object this
but it keep to give me compilation error. This is what my template function looks like:
in header
template<class T>
void StopAndRemoveParticals(ParticleSystemQuad* &emitter,T* &parent);
in c++
template<class T>
void ParticleFactory::StopAndRemoveParticals(ParticleSystemQuad* &emitter,T* &parent)
{
bool ParticlesEmitterIsActive = emitter->isActive();
if(emitter!= NULL)
{
particaleTagName tag = (particaleTagName)emitter->getTag();
parent->m_Parent->removeChildByTag(emitter->getTag());
}
}
calling this function from Some object :
1>\projects\game\classes\solutioncontainer.cpp(114): error C2664: 'void ParticleFactory::StopAndRemoveParticals<SolutionContainer>(cocos2d::ParticleSystemQuad *&,T *&)' : cannot convert parameter 2 from 'SolutionContainer *const ' to 'SolutionContainer *&'
1> with
1> [
1> T=SolutionContainer
1> ]
What am I doing wrong here and why can't I pass pointer to reference?