
From: christopher diggins <cdiggins@videotron.ca>
Before I continue, I first want to know one thing, do you (or anyone else) see any value of being able to write C++ code like the following?
#include <iostream> #include <fstream> #include "fxn_filters.hpp"
using namespace std;
void ToUpper() { char c; while (cin.get(c)) cout.put(c); }
int main() { fstream("input.txt") > Filter(ToUpper); }
In principle, the approach seems interesting. It is the approach that is being questioned here. In fact, if the idea didn't strike the fancy of anyone, you'd have gotten no discussion. How well will your scheme work with a tens of megabytes file? If you have a great deal of memory on your machine, then make it tens of gigabytes. Eventually, your approach fails because each stage of the pipeline must have a (possibly modified) copy of its input. Thus, there are at least two copies of the data in memory at once. Jonathan's library scales better, so if you can make use of it, your library will scale better. Perhaps your library providing some classes/functions to reduce the requirements levied on users to achieve your goal. IOW, there might be a way to recast your ideas to eliminate reliance on cin and cout and to avoid having to process all data at once. -- Rob Stewart stewart@sig.com Software Engineer http://www.sig.com Susquehanna International Group, LLP using std::disclaimer;