Based on this question: C++ streams confusion: istreambuf_iterator vs istream_iterator? on istreambuf_iterator
, my understanding is that istreambuf_iterator
is an iterator for raw input rather than formatted input. In that case, is it correct to assume that the template parameter of istreambuf_iterator
can only be those related to char
, such as istreambuf_iterator<char>
, istreambuf_iterator<wchar_t>
, and that something like istreambuf_iterator<int>
would be invalid?
Yes you can only use the streambuf iterators to read "characters", since it gets characters directly from the buffer. There's no formatted input involved which means it can not convert the data.