ios basic_ios和ios_base 的区别

来源:

原文翻译自:StackOverflow原文地址

前言:

关于ios,作为C++的程序员肯定不陌生,最基础的,我们在设置小数位精度的时候,要用ios::fixed。作为ACM选手,最常用的ios::sync_with_stdio(false)
笔者今天在codeforces上看别人代码时,看到别人用了ios_base::sync_with_stdio(false),遂翻阅资料,在StackOverflow看到了ios basic_basic和ios_base三者的关系,记录如下:

原文:

1.The constants are actually defined in std::ios_base but std::ios (well, actually std::basic_ios<cT, Traits>)
is derived from std::ios_base. Thus, all members definedin std::ios_base can be accessed using std::ios.

2.The class std::ios_base contains all members which entirely independent of the stream's template parameter.
std::basic_ios<cT, Traits> derives from std::ios_base and output streams.

翻译:

事实上ios是父类,ios_baseios的子类,而basic_iosios是同样的。
所以ios可以访问到ios_base的所有成员

猜你喜欢

转载自blog.csdn.net/shadandeajian/article/details/82016735
ios
今日推荐