Home > Back-end >  Why use istreambuf_iterator iterator initialization string when the second iterator need not specify
Why use istreambuf_iterator iterator initialization string when the second iterator need not specify

Time:09-17

 
# include & lt; String>
# include & lt; Fstream>
# include & lt; Streambuf>

STD: : ifstream t (" file. TXT ");
STD: : string STR ((STD: : istreambuf_iterator & lt; char> (t)),
STD: : istreambuf_iterator & lt; char> ());


Is the role of the code file is written to STD: : string, I watched the string constructor, one kind is specified fore and aft iterator methods:
 
Template String (Iter begin, Iter end)


Would you please tell me why the second iterator of the first piece of code is not specified location? And the two iterators would not be t.b do v.begin () and t.e nd () style, thank you,
  • Related