What is going on?
#include <iostream>
#include <iterator>
#include <sstream>
int main() {
std::basic_stringbuf<unsigned char> buf;
std::basic_istream<unsigned char> stream(&buf);
// the next line throws std::bad_cast on g++ 4.4
std::istream_iterator<unsigned char, unsigned char> it(stream);
}
I've tried stream.write(some_array, sizeof(some_array)
before constructing the iterator, to no avail.
Thanks.