Boost logo

Boost :

From: Douglas Gregor (gregod_at_[hidden])
Date: 2002-02-04 07:55:52


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) {}


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