How the std :: cout / object is created

So std :: cout is an object. My doubt is how / where it was created / created.

Thank.

+3
source share
1 answer

It is built with help ios_base::Init. The first time this object is created cout, friends are also created . If the last object is destroyed, coutand friends will be reset (call .flush()).

In C ++ 0x it will be guaranteed that if you enable it <iostream>, and using coutfriends afterwards #includewill use the constructed objects coutand friends. C ++ 03 says that

, , ios_base::Init , , main .

+4

Source: https://habr.com/ru/post/1780605/


All Articles