Constructor and Destructor of BodyForceGroup
Hi, All:
I am trying to add something to the BodyForceGroup template class, I want to initialize an dynamic array in its constructor and then delete it in the destructor like this:
template <class TmplParticle>
BodyForceGroup<
const BodyForceIGP &prms,
ParticleArray &particleArray
)
: m_acceleration(
m_pParticle
{
arrayVec=new double[
}
then I want to clear the array in the destructor:
template <class TmplParticle>
BodyForceGroup<
{
delete[] arrayVec;
cout << "destructor called." << endl;
}
However when I tried to run a script using this body force, it appears that the BodyForceGroup destructor was never called, hence the arrayVec is not freed.
I wonder if there is some kind of basic conceptual mistakes when I was using this template class?
Any suggestion is welcome! Thanks a lot!
Feng
Question information
- Language:
- English Edit question
- Status:
- Solved
- Assignee:
- No assignee Edit question
- Solved by:
- Vince Boros
- Solved:
- Last query:
- Last reply: