c++的设计原理是什么?标准库?
So the standard c++ library mainly contains roughly 7 categories,
what's the rationale/prototype that make it deserve being the standard?
BTW,which category does socket programing related stuff belong to in the c++ standard library?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我不知道说 C++ 标准库具有单一的统一设计原则(也许是面向对象编程、正交性或类型协变?)有多大意义,但它确实有一些技术设计目标。根据 Bjarne Stroustrup 的说法(引自 C++ 编程语言,第 429-430 页),STL 执行以下操作:
I don't know that it makes much sense to say that the C++ standard library has a single unifying design principle (perhaps object oriented programming, orthogonality, or type covariance?), but it does have some technical design goals. According to Bjarne Stroustrup (quoted from the C++ programming language, page 429-430), the STL does the following:
使 C++98 成为标准的基本原理/原型相同。
在 90 年代,许多编译器编写者都在研究 C 的扩展。这些通常涉及向 C 添加面向对象的功能(因此称为“C with Classes”)。这是互联网的早期阶段,许多参与编译器编写和语言扩展的人开始标准化事物。
标准库是该过程的一部分。 Iostreams 来自某些开发人员。标准库的大部分内容被称为“STL”的原因是因为标准模板库是一个广泛分布的原始 C++ 库,基于 C++ 编译器中流行的新功能:模板。
最终,ISO 委员会决定联合起来制定一个真正的标准。他们采用了人们称为“C++”的所有部分,解决了一些不兼容性(iostreams 成为字符类型的模板,尽管他们忘记了那里的一些东西),并最终同意了 ISO 标准。
至于“套接字编程”,它不属于 C++ 标准库的一部分。因此它不属于任何这些类别。
这些类别存在的唯一原因是因为这是标准库中的内容。 C++0x会增加更多的类别(线程是一大类)。
The same rationale/prototype that made C++98 a standard.
In the 90's, a lot of compiler writers were poking with extensions to C. These usually involved adding object-oriented features to C (hence the term "C with Classes"). This was the early days of the internet, and many people involved with compiler writing and language extensions started standardizing things.
The standard library was part of that process. Iostreams came from certain developers. The reason that much of the standard library is called "STL" is because the Standard Template Library was a widely distributed proto-C++ library based on a new feature making the rounds in C++ compilers: templates.
Eventually, an ISO committee decided to get together and form a real standard. They took all the bits that people called "C++", ironed out a few incompatibilities (iostreams became templated on the character type, though they forgot some things there), and eventually agreed on the ISO standard.
As for "socket programming," that's not part of the C++ standard library. Therefore it does not belong in any of those categories.
The only reason those categories exist is because that's what is in the standard library. C++0x will add more categories (threads is a big one).