这种断言的意图是什么?出于某种原因,我无法理解。
// Instantiate pointers of two custom types
FloatNodeType * distNodePt = distAcc.probe(origin);
Int32NodeType * indexNodePt = indexAcc.probe(origin);
assert(!distNodePt == !indexNodePt); // What is this assertion trying to make sure?发布于 2020-08-04 15:53:20
assert(!distNodePt == !indexNodePt); // What is this assertion trying to make sure?
这将检查两个指针是否指向有效内存,或者两个指针是否等于nullptr。
请注意,!是必要的,否则您将比较实际地址,这不是一回事。
https://stackoverflow.com/questions/63250539
复制相似问题