Mike Szer Mike Szer - 7 days ago 4x
C++ Question

Time complexity of C++ cout?

What is the time complexity of making a

cout <<
in C++?

If I have a
in a loop, for example:

for(int i = 0; i < 1000000 ;i++){
std::cout << i << endl;

Without the
std::cout << i << endl;
would it be much faster the loop?


Time complextiy of Cout<<:

It completely depends on what type you are printing, how you overload your "operator<<", what operations you are doing inside "operator<< overloaded function.

ostream& operator<<(ostream& os, const "yourType"& T)

second question: Yes. Obviously. "Jon Trauntvein" provided good info on it.