Hi folks,
why does the compiler give me an error, when i try to do the following
template< typename particleStore >
void prtclRender::renderRender(particleStore)
{
for( int i = 0; i < maxPart; i++ )
{
pPointVertices->posit = particleStore.pos;
pPointVertices->color = particleStore.col;
pPointVertices++;
}
}
//...
//this is the call of that function
renderRender(prtcl);
where prtcl is of type std::vector <STParticle> prtcl;
pPointVertices & maxPart are some datamember.
The version without templates has worked.
1>c:\documents and settings\ben\desktop\prometha\header\particle.h(332) : error C2275: 'particleStore' : illegal use of this type as an expression
1> c:\documents and settings\ben\desktop\prometha\header\particle.h(155) : see declaration of 'particleStore'
1> c:\documents and settings\ben\desktop\prometha\header\particle.h(155) : see reference to function template instantiation 'void prtclSys::prtclRender::renderRender<std::vector<_Ty>>(particleStore)' being compiled
1> with
1> [
1> _Ty=prtclSys::STParticle,
1> particleStore=std::vector<prtclSys::STParticle>
1> ]
1> c:\documents and settings\ben\desktop\prometha\header\particle.h(153) : while compiling class template member function 'const void prtclSys::CParticle<>::render(void)'
1> c:\documents and settings\ben\desktop\prometha\header\scene3.h(118) : see reference to class template instantiation 'prtclSys::CParticle<>' being compiled
1>c:\documents and settings\ben\desktop\prometha\header\particle.h(332) : error C2228: left of '.pos' must have class/struct/union
1>c:\documents and settings\ben\desktop\prometha\header\particle.h(333) : error C2275: 'particleStore' : illegal use of this type as an expression
1> c:\documents and settings\ben\desktop\prometha\header\particle.h(155) : see declaration of 'particleStore'
1>c:\documents and settings\ben\desktop\prometha\header\particle.h(333) : error C2228: left of '.col' must have class/struct/union