In the code snippet below, if I exclude the parenthesis around the second call to std::istreambuf_iterator
, I get a compile error on the last line:
left of .c_str() must have a class/struct/union.
std::ifstream file("file.txt");;
std::string prog(
std::istreambuf_iterator<char>(file),
(std::istreambuf_iterator<char>()));
prog.c_str();
What do these parentheses actually do? It seems to me that they should be able to be excluded.