Boost logo

Boost :

From: David Abrahams (david.abrahams_at_[hidden])
Date: 2002-02-04 09:22:31


We have boost::iterator in boost/iterator.hpp for this purpose. If you use
that, it will be compatible with more libraries.

-Dave

----- Original Message -----
From: "Douglas Gregor" <gregod_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Monday, February 04, 2002 7:55 AM
Subject: Re: [boost] [Regex] Trivial patch applied to make
string_out_iterator a real iterator

> On Sunday 03 February 2002 12:33 pm, you wrote:
> > I've applied the following trivial patch to make string_out_iterator (in
> > libs/regex/example/timer/regex_timer.cpp) a real output iterator. The
> > context diff follows.
>
> Egads, I forgot that std::iterator wasn't fully portable. I've just
applied
> the following patch to only use std::iterator when it is available, and
> otherwise just use typedefs.
>
> Doug
>
> Index: regex_timer.cpp
> ===================================================================
> RCS file: /cvsroot/boost/boost/libs/regex/example/timer/regex_timer.cpp,v
> retrieving revision 1.9
> diff -c -3 -p -r1.9 regex_timer.cpp
> *** regex_timer.cpp 2002/02/03 17:30:13 1.9
> --- regex_timer.cpp 2002/02/04 12:51:22
> *************** ostream& operator << (ostream& os, const
> *** 59,67 ****
> #endif
>
> template <class S>
> ! class string_out_iterator :
> ! public std::iterator<std::output_iterator_tag, void, void, void, void>
> {
> S* out;
> public:
> string_out_iterator(S& s) : out(&s) {}
> --- 59,77 ----
> #endif
>
> template <class S>
> ! class string_out_iterator
> ! #ifndef BOOST_NO_STD_ITERATOR
> ! : public std::iterator<std::output_iterator_tag, void, void, void,
void>
> ! #endif // ndef BOOST_NO_STD_ITERATOR
> {
> + #ifdef BOOST_NO_STD_ITERATOR
> + typedef std::output_iterator_tag iterator_category;
> + typedef void value_type;
> + typedef void difference_type;
> + typedef void pointer;
> + typedef void reference;
> + #endif // BOOST_NO_STD_ITERATOR
> +
> S* out;
> public:
> string_out_iterator(S& s) : out(&s) {}
>
> Info: http://www.boost.org Send unsubscribe requests to:
<mailto:boost-unsubscribe_at_[hidden]>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>
>


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