xcode - c++中关于boolalpha用法问题
高洛峰
高洛峰 2017-04-17 15:16:27
0
1
500

关于boolalpha,我知道它可以将布尔类型以true或者false输出。
例如 :

bool x = ture;
cout << boolalpha << x << endl;

那么会输出true;
然而在xcode输出时会联想到这个函数

boolalpha(<#std::ios_base &__str#>)

这个是什么意思呢?

高洛峰
高洛峰

拥有18年软件开发和IT教学经验。曾任多家上市公司技术总监、架构师、项目经理、高级软件工程师等职务。 网络人气名人讲师,...

reply all(1)
刘奇

std::boolalpha itself is a function, call ios_base::setf

streamReloadoperator<< (std::ios_base& (*func)(std::ios_base&)).

If it is not made into a function, it needs to be written like this, because setf returns fmtflags, not stream

cout.setf(ios_base::boolalpha);
cout << x << endl;
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!