I understand that the following code (from here) is used to read the contents of a file to string:
#include <fstream>
#include <string>
std::ifstream ifs("myfile.txt");
std::string content( (std::istreambuf_iterator<char>(ifs) ),
(std::istreambuf_iterator<char>() ) );
However, I don't understand why such seemingly redundant parentheticals are required. For example, the following code does not compile:
#include <fstream>
#include <string>
std::ifstream ifs("myfile.txt");
std::string content(std::istreambuf_iterator<char>(ifs),
std::istreambuf_iterator<char>() );
Why are so many parentheses are needed for this to compile?