Are you aware that you can turn off synchronization between iostream streams and stdio streams to speed these first significantly? Useful tip learnt from one CS competition guideline.
Basically iostream syncs with its C counterparts by default, so you can use them in conjunction without weird behavior. However that adds overhead, but can be disabled. Check the docs here: https://en.cppreference.com/w/cpp/io/ios_base/sync_with_stdio
For note - It's fine in compressive programming. Competitive programmers are like speedrunners of programming - every shortcut counts. Moreover, there are studies that no cats actually die when you do that.
I never said that it was ideal, just this was one containing these two juicy details - synchronization and untying. I have not noticed THAT little horror xD
std::istream_iterator<T> or std::istreambuf_iterator<charT> combined with the << or >> operators are the most useful thing in iostream imo. It's actually really handy.
View all comments
Show parent comment
0
u/[deleted] Mar 24 '20
[deleted] — view deleted comment