来源:
原文翻译自: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_base
是ios
的子类,而basic_ios
和ios
是同样的。
所以ios
可以访问到ios_base
的所有成员