how does ofstream or ostream type cast all types to string?

前端 未结 4 1723
庸人自扰
庸人自扰 2021-01-14 07:20

any system defined user type past to ostream object is converted to a string or char* ?

like cout<<4<<\"Hello World\";

works perfectly fine, how

4条回答
  •  逝去的感伤
    2021-01-14 08:07

    is the << operator overloaded for each and every type?

    yes

    is there a way to achieve it through just one generic overloaded function?

    this question doesn't make sense .. do you want just one function, or do you want an overloaded function?

提交回复
热议问题