you could just do assert(m_voxels[position] != nullptr). the current code would add a local variable that is only available in debug mode.