This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: bug in istream.get(b,c,d) ?


>> Consider (line at a time version of cat
>> which alway adds a final newline if not present):

> Or even easier and more efficient:

> #include <iostream>
> #include <fstream>
>
> int main (int argc, char *argv[])
> {
>     for (int i = 1; i < argc; ++i)
>         std::cout << std::ifstream (argv [i], std::ios::in).rdbuf ();
> }

OK, most agreed.  However, I did retain the assumption that he wanted
visibility into "line at a time" instead of block processing. ;-)

For absolute maximal efficiency on all libstdc++-v3 ports, also add
this line (to either example):

  std::ios::sync_with_stdio (false);

BTW, although it may appear otherwise in this e-mail, I would never
challenge Martin to an optimization contest.

Regards,
Loren


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]