Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
C++ Standard Library
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==Overview== The C++ Standard Library provides several generic containers, functions to use and manipulate these containers, function objects, generic strings and streams (including interactive and file I/O), support for some language features, and functions for common tasks such as finding the [[square root]] of a number. The C++ Standard Library also incorporates most headers of the ISO [[C standard library]] ending with "{{mono|.h}}", but their use was deprecated (reverted the deprecation since [[C++23]]<ref>{{Cite web|url=http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2021/p2340r1.html|title=Clarifying the status of the "C headers"|date=2021-06-11|first=Thomas|last=Köppe}}</ref>).<ref>ISO/IEC 14882:2003(E) ''Programming Languages – C++'' §D.5</ref> C++23 instead considers these headers as useful for interoperability with [[C (programming language)|C]], and recommends against their usage outside of programs that are intended to be both valid C and C++ programs. No other headers in the C++ Standard Library end in "{{mono|.h}}". Features of the C++ Standard Library are declared within the <code>std</code> [[namespace]]. The C++ Standard Library is based upon conventions introduced by the [[Standard Template Library]] (STL), and has been influenced by research in [[generic programming]] and developers of the STL such as [[Alexander Stepanov]] and Meng Lee.<ref>{{cite book | title=The Design and Evolution of C++ §8.5 | first=Bjarne | last=Stroustrup | year=1994 | publisher=Addison Wesley | isbn=0-201-54330-3 }}</ref><ref>{{cite web|url=http://www.hpl.hp.com/techreports/95/HPL-95-11.html|title=The Standard Template Library|first1=Alexander |last1=Stepanov |first2=Meng |last2=Lee|date=1 August 1994|publisher=HP Labs|access-date=22 October 2017}}</ref> Although the C++ Standard Library and the STL share many features, neither is a strict superset of the other.{{citation needed | date=November 2020}} The design of the C++ standard library, much like the C standard library, is minimalistic, and contains only core features for programming, lacking most of the more specialised features offered by the [[Java Class Library|Java standard library]] or [[Standard Libraries (CLI)|C# standard library]]. A noteworthy feature of the C++ Standard Library is that it not only specifies the syntax and semantics of generic algorithms, but also places requirements on their performance.<ref>"[http://www.cs.rpi.edu/~musser/gp/algorithms.html Generic Algorithms]", [[David Musser]]</ref> These performance requirements often correspond to a well-known algorithm, which is expected but not required to be used. In most cases this requires linear time O(''n'') or [[linearithmic time]] O(''n'' log ''n''), but in some cases higher bounds are allowed, such as [[quasilinear time]] O(''n'' log<sup>2</sup> ''n'') for stable sort (to allow [[In-place algorithm|in-place]] [[In-place merge sort|merge sort]]). Previously, sorting was only required to take O(''n'' log ''n'') on average, allowing the use of [[quicksort]], which is fast in practice but has poor worst-case performance, but [[introsort]] was introduced to allow both fast average performance and optimal worst-case complexity, and as of [[C++11]], sorting is guaranteed to be at worst linearithmic. In other cases requirements remain laxer, such as [[selection algorithm|selection]], which is only required to be linear on average (as in [[quickselect]]),<ref>{{cite web | url=http://en.cppreference.com/w/cpp/algorithm/nth_element | title=std::nth_element | publisher=cppreference.com | access-date=20 March 2018 }}</ref> not requiring worst-case linear as in [[introselect]]. The C++ Standard Library underwent ISO standardization as part of the C++ ISO Standardization effort in the 1990s. Since 2011, it has been expanded and updated every three years<ref>"[https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2023/p1000r5.pdf C++ IS Schedule]", [[Herb Sutter]]</ref> with each revision of the C++ standard. Since C++23, the C++ Standard Library can be imported using [[Precompiled header#Modules|modules]], which were introduced in [[C++20]].
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)