|
Boost Users : |
From: David Abrahams (dave_at_[hidden])
Date: 2006-04-07 01:57:12
Sebastian Weber <sebastian.weber_at_[hidden]> writes:
> Hello everybody!
>
> Please don't blame for beeing foolish - I'm using the iterator-adapter
> class for the first time. I converted a standard iterator from a
> std::vector with the iterator_adapter stuff into another class
> random_set_iterator. But at certain points in my programm I need the
> random_set_iterator converted back to the original iterator class from
> the vector class. I noticed the base()-function which basically does the
> job, but I think there should be a more elegant and clearer way to do
> it. Am I wrong or shouldn't an adapted iterator almost always be
> convertible to it's base iterator?
It shouldn't. Implicit conversions are generally dangerous; there's
no good reason to allow one here.
> I'm sure, it should not hard to
> implement somthing like this, but how?
You can easily add an
operator base_iterator_type() const
to random_set_iterator, but we (the authors of iterator_adaptor) don't
recommend it.
-- Dave Abrahams Boost Consulting www.boost-consulting.com
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