I'm getting started with Boost.Intrusive, specifically interested in the doubly-linked list (boost::intrusive::list
).
This would be trivial to do in a "hand-rolled" linked list, but so far I can't find a Boost equivalent:
Given a node that belongs to a list, how do I check to see if it represents the end of the list, without needing the owning container.
In a hand-made list, this would be as simple as checking if the "next" pointer is NULL.
With boost::intrusive::list
, there is the s_iterator_to
function, which converts a plain node to an iterator. And you can check that against mylist.end()
, which gives the desired result, but it requires a reference to the list container itself.
I also note that using operator++
on such an iterator simply produces a garbage value once it is moved past the end — no error or assert from Boost.