A Tour of C++ (C++ In-Depth Series)

A Tour of C++ (C++ In-Depth Series)

Bjarne Stroustrup

Language: English

Pages: 193

ISBN: 0321958314

Format: PDF / Kindle (mobi) / ePub

The C++11 standard allows programmers to express ideas more clearly, simply, and directly, and to write faster, more efficient code. Bjarne Stroustrup, the designer and original implementer of C++, thoroughly covers the details of this language and its use in his definitive reference, The C++ Programming Language, Fourth Edition.
In A Tour of C++ , Stroustrup excerpts the overview chapters from that complete reference, expanding and enhancing them to give an experienced programmer–in just a few hours–a clear idea of what constitutes modern C++. In this concise, self-contained guide, Stroustrup covers most major language features and the major standard-library components–not, of course, in great depth, but to a level that gives programmers a meaningful overview of the language, some key examples, and practical help in getting started.

Stroustrup presents the C++ features in the context of the programming styles they support, such as object-oriented and generic programming. His tour is remarkably comprehensive. Coverage begins with the basics, then ranges widely through more advanced topics, including many that are new in C++11, such as move semantics, uniform initialization, lambda expressions, improved containers, random numbers, and concurrency. The tour ends with a discussion of the design and evolution of C++ and the extensions added for C++11.

This guide does not aim to teach you how to program (see Stroustrup’s Programming: Principles and Practice Using C++ for that); nor will it be the only resource you’ll need for C++ mastery (see Stroustrup’s The C++ Programming Language, Fourth Edition, for that). If, however, you are a C or C++ programmer wanting greater familiarity with the current C++ language, or a programmer versed in another language wishing to gain an accurate picture of the nature and benefits of modern C++, you can’t find a shorter or simpler introduction than this tour provides.















other function objects to give standard algorithms a wider range of meanings; §10.5, §10.6. [8] A predicate must not modify its argument; §10.5. [9] Know your standard-library algorithms and prefer them to hand-crafted loops; §10.6. [10] When the pair-of-iterators style becomes tedious, introduce a container/range algorithm; §10.7. 11. Utilities The time you enjoy wasting is not wasted time. – Bertrand Russell • Introduction • Resource Management unique_ptr and shared_ptr •

languages provide support for this. The support provided by the C++ standard library is a portable and type-safe variant of what has been used in C++ for more than 20 years and is almost universally supported by modern hardware. The standard-library support is primarily aimed at supporting systems-level concurrency rather than directly providing sophisticated higher-level concurrency models; those can be supplied as libraries built using the standard-library facilities. The standard library

context of its use. I spent a lot of time listening to users and seeking out the opinions of experienced programmers. In particular, my colleagues at AT&T Bell Laboratories were essential for the growth of C++ during its first decade. This section is a brief overview; it does not try to mention every language feature and library component. Furthermore, it does not go into details. For more information, and in particular for more names of people who contributed, see [Stroustrup,1993],

particular, most features that are new in C++11 make no sense in isolation from the framework provided by older features. [1] Uniform and general initialization using {}-lists (§1.5, §4.2.3) [2] Type deduction from initializer: auto (§1.5) [3] Prevention of narrowing (§1.5) [4] Generalized and guaranteed constant expressions: constexpr (§1.7) [5] Range-for-statement (§1.8) [6] Null pointer keyword: nullptr (§1.8) [7] Scoped and strongly typed enums: enum class (§2.5) [8] Compile-time

templates (Chapter 5) to specify families of functions and types, and namespaces (§3.3) to avoid name clashes. [4] Don’t declare a variable before you need it, and initialize it immediately. A declaration can occur anywhere a statement can (§1.9), in for-statement initializers (§1.8), and in conditions (§4.5.3). [5] Don’t use malloc(). The new operator (§4.2.2) does the same job better, and instead of realloc(), try a vector (§4.2.3, §10.1). Don’t just replace malloc() and free() with “naked”

Download sample