using namespace folly::gen; byLine('/a/file/with/numbers') | eachTo<int> | sum;
#include <fstream> #include <iterator> #include <numeric> using namespace std; int main() { ifstream nf ("numbers.txt"); return accumulate (istream_iterator<int>(nf), istream_iterator<int>(), 0); }