4 ms·
Using the <iostream> stuff isn’t really idiomatic - on both modern and legacy code bases I’ve used operator<< overloads on custom types, but never called std::c
by clappski 8y ago
Using the <iostream> stuff isn’t really idiomatic - on both modern and legacy code bases I’ve used operator<< overloads on custom types, but never called std::cout in a hot loop or used std::endl to do anything but actually flush the stream.
- muizelaar 8y agoWhat would you suggest is C++ recommended way for doing io?
- IshKebab 8y agoI would use std::cout but output "\n" instead of endl.
- prewett 8y agoIs std::endl guaranteed to flush the stream? I’d think you’d be better off with std::cout::flush(), std::flush if you prefer manipulators. It would certainly be clearer, assuming it’s not temporary debug code.
- wbkang 8y agoIt is guaranteed to flush.
- TheCoelacanth 8y agoIt is. That is the only reason to use it other than '\n'
- pjmlp 8y agoSure it is. Not everyone is micro-optimizing their code just to save a couple of needless extra ms. I never, ever since 1993, had to work on a C++ project where stdio vs iostream performance made any worthwhile difference, besides stdio being less secure to use.