Ifstreambuf_iterator and Char by char input

Hi all,
I am not able to understand what the following declaration does
1
2
   
    string((istream_iterator<char>(inputFile)),(istream_iterator<char>()))


Would be great if someone could explain this to me!
string((istream_iterator<char>(inputFile)),(istream_iterator<char>()))

Is the above a self-written function or a standard C++ function ?

Refer to http://www.cplusplus.com/reference/std/iterator/istream_iterator/ and see what is istream_iterator.

I believe the above arguments say , construct an object istream_iterator<char>(inputFile) where it is an iterator that "point" to the inputFile which should be an istream class and whenever we do a ++ we read one char into variable. The other object istream_iterator<char>() should be the end-of-file indicator.

It is like open the inputFile (istream class) and read char one by one until detect end-of-stream stop. Those char read should most likely be stored somewhere for retrieval later on.

Topic archived. No new replies allowed.