How is the `llvm::ilist_iterator<NodeTy>::operator pointer() const` method utilized?

228 views Asked by At

I've found that the implementation of this method was to simply return the pointer stored within the ilist_iterator class (http://llvm.org/docs/doxygen/html/ilist_8h_source.html#l00195). However, it is unclear to me how this operator is used.

I'm assuming that with that operator, we can do the following. ... ilist_iterator<NodeType> it = ...; NodeType const *node = it; // rather than &(*it)? ... Is my assumption correct?

1

There are 1 answers

3
Jim Oldfield On

That is precisely what it does. It also allows it to be passed as an argument to a function that takes a NodeType* parameter. (It feels like it could be a bit dangerous to me, but I can't think of a specific situation where it would be a problem.)