What's the difference between "STL" and "C++ Standard Library"? Ask Question

What's the difference between

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?

ベストアンサー1

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 various websites — 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.

また、すべての関係者が話し合われている内容を理解していれば、それはあまり問題ではないと考える人たちも含まれます。

これは、C++ の「テンプレート」と呼ばれる機能を多用する性質上、さらに普及している用語です。

「C++ 標準ライブラリ」(または stdlib) の場合

しかし、これは混乱を招くという別の考え方もあります (私もこれに賛成です)。初めて C++ を学ぶ人はこの違いを知らず、言語の小さな違いに気付かないかもしれません。

この記事の著者は、C++ 標準ライブラリ全体がSTLであると信じている人々に何度も遭遇しました。これには、STL 自体には含まれていない機能も含まれています。対照的に、「STL」の熱心な支持者のほとんどは、それが何を意味するのかを正確に理解しており、誰もが「理解」しているわけではないと信じようとしません。明らかに、この用語の使用法は統一されていません。

さらに、C++標準ライブラリではなく、実際にはオリジナルのSTLの実装であるSTLのようなライブラリもいくつかあります。最近まで、STLポートそのうちの一人(そして、混乱豊富にあります!

さらに、C++ 標準には「STL」というテキストがどこにも含まれておらず、一部の人々は「STL はC++ 標準ライブラリに含まれています」などのフレーズを習慣的に使用していますが、これは明らかに誤りです。

この言葉の使い方をこのように広め続けることは、誤解が永遠に続くことにつながるだけだと私は信じています。悲しいことに、たとえそれが良い方向に向かうはずだったとしても、物事を変えようとする試みは完全に逆効果になるかもしれません。私たちは永遠に二重の意味に縛られ続けるだけかもしれません。

結論

この投稿が少し偏っていることを承知しています。リンクした記事は私が書いたものです。:) とにかく、これが戦いをもう少しわかりやすく説明するのに役立つことを願っています。

2011年4月13日更新

ここには三つ 完璧 C++ 標準ライブラリ全体を指すのに「STL」を使用している人のことです。毎日のように目にする明らかな事実にもかかわらず、これほど多くの人が、誰もそんなことはしていないと断言していることに、私はいまだに困惑しています。

おすすめ記事