Boost logo

Boost :

From: David Abrahams (david.abrahams_at_[hidden])
Date: 2001-12-14 07:04:00


----- Original Message -----
From: "rogeeff" <rogeeff_at_[hidden]>

> Rationale for my questions is performance considerations. Let say I
> need to process input stream ~ 20000 times per second. I have
> iterator over this stream which is implemented using iterator_adaptor
> over light weight Base iterator and statefull Policies ( meaning that
> copy constructor for the
> m could be expensive). I have at least 2 choises: Instantiate my
> iterator every time (in which case I would like to prevent Policies
> from copying) or I can instantiate it once and than reset every time
> with new Base iterator (plus Policies initialize call). Any other
> variants?

Okay, point taken. Fortunately, I think you may be in luck! This is the end
of the iterator_adaptor declaration:

    ...
public: // implementation details (too many compilers have trouble when
these are private).
    base_type& base() { return m_iter_p.first(); }
    Policies& policies() { return m_iter_p.second(); }
    const Policies& policies() const { return m_iter_p.second(); }
};

You could try to use these functions to re-initialize your policies object
and/or base object. If this works for you, we can think about enshrining
these accessors in the documentation.

-Dave


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk