理解C++中STL与Standard Library

  • STL

From wikipedia, the Standard Template Library (STL) is a software library for the C++ programming language that influenced many parts of the C++ Standard Library. It provides four components called:

  1. algorithms

    A large number of algorithms to perform activities such as searching and sorting are provided in the STL, each implemented to require a certain level of iterator.

  2. containers

    The STL contains sequence containers and associative containers. The containers are objects that store data.

    The standard sequence containers include vector, deque, and list.

    The standard associative containers are set, multiset, map, multimap, hash_set, hash_map, hash_multiset, hash_multimap.

    There are also container adaptors queue, priority_queue, stack, that are containers with specific interface, using other containers as implementation.

  3. functions

    The STL includes classes that overload the function call operator(operator()). Instances of such classes are called functions or function objects.

  4. iterators

    The STL implements five different types of iteartors. These are :

    • input iterators

      Only be used to read a sequence of values

    • output iterators

      Only be used to write a sequence of values

    • forward iterators

      Can be read, written to, and move forward

    • bidirectional iterators

      Like forward iterators, but can also move backwards

    • random access iterators

      Can move freely any number of steps in one operation

The STL provides a set of common classes for C++, such as containers and associative arrays, that can be used with any built-in type and with any user-defined type that supports some elementary operations(such as copying and assignment)

  • C++ Standard Library

From wikipedia, the C++ Standard Library is a collection of classes and functions, which are written in the core language and part of the C++ ISO Stardard itself.

The C++ Standard Library is based upon conventions introduced by the Standard Template Library (STL), and has been influced by research in generic programming and developers of the STL such as Alexander Stepanov and Meng Lee.

Although the C++ Standard Library and the STL share many features, neither is a stict superset of the other.

  • Alexander Stepanov

From wikipedia, Alexander Stepanov is a Russian-American computer programmer, best known as an adcocate of generic programming and as the primary designer and implementer of the C++ Standard Template Library, which he started to develop around 1992 while employed at HP Labs.

BOOKs:

Elements of Programming

《 From Mathematics to Generic Programming》

He tries to convince Bjarne Stroustrup to introduce something like Ada generics in C++/

  • STL vs. C++ Standard Library

Stepanov’s genius changed the way we program.

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:1998(《理解gcc||g++||C11等版本问题》).

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

Silicon Graphics has made its implementation of the C++ Standard Template Library freely available to the public.

SGI is one kind of STL implementation versions.

  • References

  1. What’s the difference between “STL” and “C++ Standard Library”?
  2. What is the difference between the standard library and the standard template library?
C++ Standard Library Quick Reference by Peter Van Weert, Marc Gregoire 2016 | ISBN: 1484218752 | English | 206 pages PDF+EPUB This quick reference is a condensed reference guide to the essential data structures, algorithms, and functions provided by the C++ Standard Library. More specifically, this is a compact collection of essential classes and functions, used by C++ programmers on a daily basis. The C++ Standard Library Quick Reference features core classes for strings, I/O streams, and various generic containers, as well as a comprehensive set of algorithms to manipulate them. In recent years, the C++11 and C++14 standards have added even more efficient container classes, a new powerful regular expression library, and a portable multithreading library featuring threads, mutexes, condition variables, and atomic variables. Needless to say, it is hard to know and remember all the possibilities, details, and intricacies of this vast and growing library. This handy reference guide is therefore indispensable to any C++ programmer. It offers a condensed, well-structured summary of all essential aspects of the C++ Standard Library, including all aforementioned functionality. No page-long, repetitive examples or obscure, rarely used features. Instead, everything you need to know and watch out for in practice is outlined in a compact, to-the-point style, interspersed with well-chosen, clarifying examples. The book does not explain the C++ language or syntax, but is accessible to anyone with basic C++ knowledge. Even the most experienced C++ programmer though will learn a thing or two from it and find it a useful memory-aid. What You Will Learn • The essentials that the C++ Standard Library has to offer • How to use containers to efficiently store and retrieve your data • How to use algorithms to inspect and manipulate your data • How lambda expressions allow for elegant use of algorithms • What the standard string class provides and how to use it • What functionality the library provides for file and stream-based I/O • What smart pointers are and how to use them to prevent memory leaks • How to write safe and efficient multi-threaded code using the C++11 threading libraries
The Best-Selling Programmer Resource–Now Updated for C++11 The C++ standard library provides a set of common classes and interfaces that greatly extend the core C++ language. The library, however, is not self-explanatory. To make full use of its components - and to benefit from their power - you need a resource that does far more than list the classes and their functions. The C++ Standard Library - A Tutorial and Reference, 2nd Edition describes this library as now incorporated into the new ANSI/ISO C++ language standard (C++11). The book provides comprehensive documentation of each library component, including an introduction to its purpose and design; clearly written explanations of complex concepts; the practical programming details needed for effective use; traps and pitfalls; the exact signature and definition of the most important classes and functions; and numerous examples of working code. The book focuses on the Standard Template Library (STL), examining containers, iterators, function objects, and STL algorithms. You will also find detailed coverage of strings, concurrency, random numbers and distributions, special containers, numerical classes, internationalization, and the IOStreams library. An insightful introduction to fundamental concepts and an overview of the library will help bring newcomers quickly up to speed. A comprehensive index will support the C++ programmer in his/her day-to-day life. The book covers all the new C++11 library components, including Concurrency Fractional arithmetic Clocks and Timers Random numbers and distributions New smart pointers Regular expressions New STL containers, such as arrays, forward lists, and unordered containers New STL algorithms Tuples Type traits and type utilities The book also examines the new C++ programming style and its effect on the standard library, including lambdas, range-based for loops, and variadic templates. An accompanying Web site, including source code, can be found at http://www.josuttis.com/.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值