“STL”之间的区别是什么,和“C ++标准库”? [英] What's the difference between "STL" and "C++ Standard Library"?

查看:115
本文介绍了“STL”之间的区别是什么,和“C ++标准库”?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人带来了这篇文章,让我注意到声明(我是释义) STL术语被误用为指代整个C ++标准库,而不是从SGI STL获取的部分。


(...)它指的是STL,尽管事实上很少有人仍然使用STL(它是在SGI设计的)。



C ++标准库的一部分是基于STL的一部分,正是这些部分,许多人(包括几个作者和臭名昭着的cplusplus.com)仍然称为STL 。然而,这是不准确的;事实上,C ++标准从未提到STL,并且两者之间存在内容差异。



(...)STL很少用于指基于SGI STL的stdlib的位。人们认为它是整个标准库。它得到简历。这是误导。


我几乎不知道C ++的历史,所以我不能判断文章的正确性。我应该避免使用术语STL吗?

解决方案

STL是由亚历山大·斯捷潘诺夫写的在C ++标准化前的日子。 C ++存在于80年代,但我们现在称为 C ++ 是ISO / IEC标准化的语言14882:2014(以及早期版本,如ISO / IEC 14882:2011)。



STL已经广泛用作C ++的库, ,迭代器和算法。当标准化发生时,语言委员会设计 C ++标准库(它是语言标准的一部分)的部分非常符合STL。



这些年来,很多人—包括知名书籍作者,以及出名的 cplusplus.com —继续将C ++标准库称为STL,尽管这两个实体是分开的,并且存在一些差异。这些差异在即将到来的新C ++标准中更加明显,其中包括各种功能并显着改变了一些类。



原来的STL通常被称为 C ++标准模板库(而不是实际的历史!),与Microsoft Visual Studio或GCC发布C ++标准库的实现相同的方式。但是标准模板库和标准库是不一样的。



战斗是关于当前的标准库是否应该称为STL



对于STL



有一个思想学派说,现在所有人都知道STL意味着标准库,就像大家现在知道C ++是ISO标准化语言。



它还包括那些相信只要所有各方都了解正在谈论的内容就会有所影响的人。



这个术语因野兽的性质而更加流行,其中大部分都使用了称为模板的C ++功能。



对于C ++标准库(或stdlib)



但是,我订阅了—这说明这是令人困惑的。第一次学习C ++的人不会知道这种区别,并且可能不会注意到小的语言差异。



该文章的作者有很多时代遇到的人相信整个C ++标准库 STL,包括从来不是STL本身的一部分的功能。相比之下,STL的大多数声音支持者确切地知道它们是什么意思,并拒绝相信并不是每个人都获得它。显然,该术语的用法是不统一的。



此外,还有一些类似STL的库实际上是原始STL的实现,而不是C ++标准库。直到最近, STLPort 是其中之一(甚至还有混淆)。



此外,C ++标准在任何地方都不包含文本STL使用像C ++标准库中包含的STL这样的短语,这是明显不正确的。



这是我的信念,继续以这种方式传播术语的使用将只会导致误解永远。唉,试图改变事情可能是完全相反的,即使它应该是更好的。


$ b

结束

谢谢这篇文章有点偏见:我写了你链接到的文章。 )



更新13/04/2011



以下是三个 完美 示例某人使用 STL来引用整个C ++标准库。它继续阻碍我,这么多人发瞎了,没有人这样做,当几乎每天看到几乎看到。


Someone brought this article to my attention that claims (I'm paraphrasing) the STL term is misused to refer to the entire C++ Standard Library instead of the parts that were taken from SGI STL.

(...) it refers to the "STL", despite the fact that very few people still use the STL (which was designed at SGI).

Parts of the C++ Standard Library were based on parts of the STL, and it is these parts that many people (including several authors and the notoriously error-ridden cplusplus.com) still refer to as "the STL". However, this is inaccurate; indeed, the C++ standard never mentions "STL", and there are content differences between the two.

(...) "STL" is rarely used to refer to the bits of the stdlib that happen to be based on the SGI STL. People think it's the entire standard library. It gets put on CVs. And it is misleading.

I hardly know anything about C++'s history so I can't judge the article's correctness. Should I refrain from using the term STL? Or is this an isolated opinion?

解决方案

The "STL" was written by Alexander Stepanov in the days long before C++ was standardised. C++ existed through the 80s, but what we now call "C++" is the language standardised in ISO/IEC 14882:2014 (and earlier versions, such as ISO/IEC 14882:2011).

The STL was already widely used as a library for C++, giving programmers access to containers, iterators and algorithms. When the standardisation happened, the language committee designed parts of the C++ Standard Library (which is part of the language standard) to very closely match the STL.

Over the years, many people — including prominent book authors, and the notoriously error-ridden cplusplus.com — have continued to refer to the C++ Standard Library as "the STL", despite the fact that the two entities are separate and that there are some differences. These differences are even more pronounced in the upcoming new C++ standard, which includes various features and significantly alters some classes.

The original STL is now often called "an implementation of the C++ Standard Template Library" (rather backwards to actual history!), in the same way that your Microsoft Visual Studio or GCC ships an implementation of the C++ Standard Library. But the "Standard Template Library" and the "Standard Library" are not the same thing.

The battle is about whether the current Standard Library should be called "the STL" in whole or in part, and/or whether it matters what it's called.

For "STL"

There is a school of thought that says that everybody knows now that "STL" means the standard library, just as everybody now knows that "C++" is the ISO-standardised language.

It also includes those who believe that it doesn't really matter as long as all parties understand what is being talked about.

It's a term made even more prevalent by the nature of the beast, much of which makes heavy use of the C++ feature known as "templates".

For "C++ Standard Library" (or stdlib)

However, there is another school of thought — to which I subscribe — that says that this is confusing. People learning C++ for the first time do not know this distinction, and may not notice small language differences.

The author of that article has numerous times encountered people who believe that the entire C++ Standard Library is the STL, including features that were never part of the STL itself. Most vocal proponents of "the STL", in contrast, know exactly what they mean by it and refuse to believe that not everybody "gets it". Clearly, the term's usage is not uniform.

In addition, there are some STL-like libraries that are in fact implementations of the original STL, not the C++ Standard Library. Until recently, STLPort was one of them (and even there, the confusion abounds!).

Further, the C++ Standard does not contain the text "STL" anywhere, and some people habitually employ phrases like "the STL is included in the C++ Standard Library", which is plain incorrect.

It's my belief that continuing to propagate the usage of the term in this way will just lead to the misunderstanding going on forever. Alas, it may be entirely counter-productive to attempt to change things, even if it's supposed to be for the better. We may just be stuck with double-meanings forever.

Conclusion

I appreciate that this post has been a little biased: I wrote the article you linked to. :) Anyway, I hope this helps to explain the battle a bit better.

Update 13/04/2011

Here are three perfect examples of someone who is using "the STL" to refer to the entire C++ Standard Library. It continues to baffle me that so many people swear blind that nobody ever does this, when it's plain to see almost on a daily basis.

这篇关于“STL”之间的区别是什么,和“C ++标准库”?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆