Boost logo

Boost Users :

Subject: [Boost-users] [io::streams] Using array device and std::output_iterator
From: Ovanes Markarian (om_boost_at_[hidden])
Date: 2011-07-13 09:47:36


Hello *,

I tried to use an array-device based stream and wantet to pass the stream to
std::output_iterator or std::istream_iterator, but unfortunately, I get a
compilation error with gcc 4.3.5.
Boost::IOStreams docu states that the io::stream is either derived from
std::basic_istream or std::basic_ostream or both dependent on the underlying
device category. array has seekable category, so I'd expect io::stream to
derive from both and be compatible with ostream_iterator or
istream_iterator.

Here is the code snippet:

  typedef unsigned char byte;
  typedef io::basic_array<byte> array_device;
  typedef io::stream<array_device> array_stream;

  array_stream ios_(ptr_to_byte_array);

  std::istream_iterator<byte> in(ios_);

And the last line results in the error stating:

src/chunk_reading_iterator_test.cpp: In member function 'void
chunk_reading_iterator_suite::ctor::test_method()':
src/chunk_reading_iterator_test.cpp:86: error: no matching function for call
to 'std::istream_iterator<unsigned char, char, std::char_traits<char>,
int>::istream_iterator(chunk_reading_iterator_suite::<unnamed>::array_stream&)'

Thanks for any suggestions,
Ovanes



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