Boost logo

Boost Users :

From: remi.chateauneu_at_[hidden]
Date: 2005-07-18 02:25:15


For istream_iterator or ostream_iterator, the operator '<<' and '>>' are
used to serialize the data. Have anyone ever needed another operator
(typically for serializing to another format, for example binary) ? To
implement this, it seems possible to add the serializing operator to
istream_iterator, as an extra template argument, which would by default
use the existing operator>>.

In other words :
  template<typename _Tp, typename _CharT = char,
           typename _Traits = char_traits<_CharT>, typename _Dist =
ptrdiff_t>
    class istream_iterator { ...

... would be replaced by something like :

   template<typename _Tp, typename _CharT = char,
           typename _Traits = char_traits<_CharT>, typename _Dist =
ptrdiff_t,
    typename _SerializingOperator = XXXXX >
    class istream_iterator { ...

XXXXX would represent the existing operator>> for this data type. On the
other hand, 'operator>>' is not a method of class _Tp, but a friend
method. So, how to specify it are a default template argument ?


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