|
Boost : |
From: Daryle Walker (darylew_at_[hidden])
Date: 2001-06-13 11:18:50
on 6/13/01 6:22 AM, Aleksey Gurtovoy at alexy_at_[hidden] wrote:
> David Abrahams wrote:
>> The interface to output_iterator_helper needs to be changed anyway, to
>> remove all of those parameters which default to void (an
>> output iterator /must/ have void value_type and differnce_type anyway).
>
> Talking about interface changes - how about this:
>
> template<class Derived>
> struct output_iterator_helper
> : boost::incrementable<Derived
> , boost::iterator<std::output_iterator_tag, void, void, void, void
> >>
> {
> Derived& operator*() { return static_cast<Derived&>(*this); }
> Derived& operator++() { return static_cast<Derived&>(*this); }
> };
>
> Self-proxing is the most common and easy way to implement output iterators,
> and IMO it would be reasonable for 'output_iterator_helper' to provide a
> default support for the idiom, if this does not prevent other usages. AFAIK,
> the above form doesn't. Basically, it's what we are using here at work, and
> I would love to replace it by the boost code instead :).
But so far, we just had enough code to support the secondary operators. Now
you want to add code to implement primary operators; that sounds like a big
leap. What if an iterator doesn't want to use self-proxying?
-- Daryle Walker Mac, Internet, and Video Game Junkie darylew AT mac DOT com
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk