我正在浏览 Sequitur G2P 的代码发现了一行很奇怪的代码:
public:
...
const Node *childrenEnd() const { return (this+1)->finalized.firstChild_; }
我知道this
是指向当前对象的指针,既然是指针,所以操作是完全合法的,但是this+1
究竟指的是什么去?
最佳答案
可能 this
是数组的一部分,因此 this+1
将引用该数组中的下一个对象。
关于c++ - 指针 'this+1' 在 C++ 中指的是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45340891/