Boost logo

Boost Users :

Subject: [Boost-users] [Intrusive] Obtaining end iterator from value reference
From: Andrea Cuneo (andrea.cuneo.kail_at_[hidden])
Date: 2013-04-29 06:20:17


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.

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

// snipped
struct dummy : public slist_base_hook<> {};
typedef slist<dummy> MyList;

void fn(dummy const& o)
{
  MyList::const_iterator it = MyList::s_iterator_to(o);
  MyList::const_iterator e = ???;
  for (; it != e; ++it) { ... }
}

Regards,
Andrea



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