Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
include/llvm/ADT/PostOrderIterator.h | ||
---|---|---|
93–95 ↗ | (On Diff #68069) | This is because po_iterator has "non-standard" operator*() and operator->(). Ideally, value_type should be NodeRef, reference type is NodeRef& and pointer_type is NodeRef*, but that way the current operator*() and operator->()'s returned types don't suffice. I think it's an orthogonal issue apart from this patch. |
126 ↗ | (On Diff #68069) | The conversion doesn't work here, because po_iterator_storage has insertEdge as a template function on NodeRef. We can move the "template <typename NodeRef>" from insertEdge up to po_iterator_storage, but that involves other po_iterator_storage template changes as well. |
include/llvm/ADT/PostOrderIterator.h | ||
---|---|---|
126 ↗ | (On Diff #68069) | Alternatively you could take the first argument to insertEdge as an opaque parameter (another template parameter T) and then convert it in the implementation: Optional<NodeRef> From = FromValue; But that might be too weird/complicated with all the different implementations. |
include/llvm/ADT/PostOrderIterator.h | ||
---|---|---|
93–95 ↗ | (On Diff #68081) | Hey somehow I realized that it's only operator->() that is non-standard. I make std::iterator<...> normal, leaving operator->() returning NodeRef. If NodeRef isn't a pointer and the user never calls PoIterator->..., the user code still builds. |
122 ↗ | (On Diff #68081) | Yeah, the main reason I don't want that is it aggressively generalize the insertEdge's interface. |
include/llvm/ADT/PostOrderIterator.h | ||
---|---|---|
122 ↗ | (On Diff #68081) | Not sure I follow - it doesn't really make the interface more permissive (if there were overloads then you'd need some SFINAE to promote the internal template errors out onto the interface to ensure overload resolution did the right thing is the only big wrinkle) - so far as I can see. Anything that can be implicitly converted to Optional<NodeRef> seems to be what the function is trying to accept. |
include/llvm/ADT/PostOrderIterator.h | ||
---|---|---|
122 ↗ | (On Diff #68081) | Assuming that the user relies on template argument deduction, then the user has to pass in an Optional<...> object, right? This limits the interface to take Optional objects, not any T that is convertible to an Optional object. If the user doesn't rely on template argument deduction, they are the same. |