1
可以使用itk::NumericTraits
获得某种类型的0和1。因此,我们可以在野外看到这种代码:NumericTraits Zero and One
const PixelType ZERO = itk::NumericTraits<PixelType>::Zero;
const PixelType ONE = itk::NumericTraits<PixelType>::One;
这感觉很沉重,很难阅读。作为程序员,我更喜欢更实用的版本,例如:
const PixelType ZERO = 0;
const PixelType ONE = 1;
但是它是完全等价的吗?我认为演员是在编辑过程中完成的,所以两个版本的速度应该是相同的。如果是这样的话,为什么有人想用itk::NumericTraits
得到0和1?必须有我没有看到的优势。