来源:
原文翻译自: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的所有成员
C++与IO流类关系解析
本文深入探讨了C++中ios、ios_base和basic_ios三者之间的关系,揭示了它们在标准输入输出流中的作用及继承关系,对于理解C++ IO流操作具有重要意义。
1127

被折叠的 条评论
为什么被折叠?



