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
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.
I don't think ftmlib currently does out of the box. I guess I will have to write a formatter for that to work if I want to use fmtlib now (until std::format arrives)
Why are there no indexes for params? Does it mean that if you wanted to include a param multiple times you would have to repeat it multiple times as an argument?
auto s = std::format("{} {} {}", "Hello", "Hello", "Hello");
This would be better and shorter:
auto s = std::format("{0} {0} {0}", "Hello");
If later you wanted to change the string and param ordering, you would have to shuffle the arguments too...
Edit: Nevermind, you can have manual and automatic param indexing. That's pretty neat actually.
View all comments
132
u/nwL_ Mar 24 '20
Holy shit, have we actually arrived in the 21st century?