Boost logo

Boost :

From: Neal Becker (ndbecker2_at_[hidden])
Date: 2004-09-06 20:48:52


Jonathan Turkanis wrote:

>> Adding #include <iostream> fixes this problem.
>
> What file did you add the include to? I'm trying to get by with <iosfwd>
> and <ios> wherever possible.
>

I added it to my Test program. I don't know what the problem is at this
point, but here is the test case. If you leave #include <iostream>
commented, compile with g++34 fails, but uncomment and it's OK.

#include <iostream>

#include <boost/io/stream_facade.hpp>
#include <vector>
#include <string>

namespace io = boost::io;

  
#include <vector>
#include <boost/io/concepts.hpp> // sink

struct vector_sink : public io::sink {
  vector_sink(std::vector<char>& _vec) : vec(_vec) { }
  void write(const char* s, std::streamsize n)
  {
    vec.insert(vec.end(), s, s + n);
  }
  std::vector<char>& vec;
};

std::vector<char> F () {
  std::vector<char> v;
  vector_sink s (v);

  io::stream_facade<vector_sink> out(s);

  out << "hello";

  out.close();

  return v;
}

int main() {
  F();
}


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