Boost logo

Boost Users :

Subject: Re: [Boost-users] [Intrusive] Obtaining end iterator from value reference
From: Ion Gaztañaga (igaztanaga_at_[hidden])
Date: 2013-04-29 12:34:17


El 29/04/2013 12:20, Andrea Cuneo escribió:
> Hi all,
>
> is it possible with boost::intrusive::slist to obtain the end() iterator
> from a value object present in a list?
> Using s_iterator_to() I can obtain a valid iterator from a value reference
> but i can't forward iterate from it without knowing the end().
>
> Reading the slist code I found the method slist_iterator::get_container but
> since is a detail implementation, I prefer not to use it.

In most cases it returns null (a pointer to the container is stored only
when dereferencing needs to access some container-stored value-traits),
s_iterator_to can't be used when value_traits is stateful, so that
function is not going to help you.

> I also found that a default construct iterator is almost equivalent to
> end() for linear slists and should work just fine. For circular slists?

There is no way to obtain the end node from a node in a circular list,
as there is no runtime information stored in the ring that marks the end
node.

Best,

Ion


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net