2014-09-13 175 views
1

我最近在一個迭代器類代碼這是什麼意思:&** this;

pointer operator->() { 
    return &**this; 
} 

有人能請解釋一下是如何工作的看到這個。

+1

一個可能應該使用'std :: addressof(** this)' – 2014-09-13 05:42:30

回答

3

this是一個指向迭代器類的指針。 *this是迭代器本身。 **this是調用this->operator*()的結果 - 大概是對底層容器中元素的引用。然後&**this是指向所述元素的(原始,啞指針)指針。