ファイルの内容を文字列に読み取るために、次のコード ( from here ) が使用されていることを理解しています。
#include <fstream>
#include <string>
std::ifstream ifs("myfile.txt");
std::string content( (std::istreambuf_iterator<char>(ifs) ),
(std::istreambuf_iterator<char>() ) );
しかし、なぜこのような一見冗長な括弧が必要なのか理解できません。たとえば、次のコードはコンパイルされません。
#include <fstream>
#include <string>
std::ifstream ifs("myfile.txt");
std::string content(std::istreambuf_iterator<char>(ifs),
std::istreambuf_iterator<char>() );
これをコンパイルするには、なぜこれほど多くの括弧が必要なのですか?