Taking into account that this is just a "miniature" version from real code. Can it be that your actual code is calling NDIMVoxelStructure
's copy constructor (e.g. through a function that returns a NDIMVoxelStructure
element) and, then, voxels_
is not properly initialized?
In previous situation, if voxels_
is a pointer, default copy constructor would, initially, swallow copy the NULL value but, probably, something else can be running behind the scenes.
I would suggest to also define NDIMVoxelStructure
's copy constructor and check if it's called.