Thinking in C++ Vol 2 - Practical Programming |
Prev |
Home |
Next |
Standard C++ not only incorporates all the Standard C libraries
(with small additions and changes to support type safety), it also adds
libraries of its own. These libraries are far more powerful than those in
Standard C; the leverage you get from them is analogous to the leverage you get
from changing from C to C++.
This section of the book gives you an in-depth introduction
to key portions of the Standard C++ library.
The most complete and also the most obscure reference to the
full libraries is the Standard itself. Bjarne Stroustrup s The C++
Programming Language, Third Edition (Addison Wesley, 2000) remains a
reliable reference for both the language and the library. The most celebrated
library-only reference is The C++ Standard Library: A Tutorial and Reference,
by Nicolai Josuttis (Addison Wesley, 1999). The goal of the chapters in this
part of the book is to provide you with an encyclopedia of descriptions and
examples so that you ll have a good starting point for solving any problem that
requires the use of the Standard libraries. However, some techniques and topics
are rarely used and are not covered here. If you can t find it in these
chapters, reach for the other two books; this book is not intended to replace
those books but rather to complement them. In particular, we hope that after
going through the material in the following chapters you ll have a much easier
time understanding those books.
You will notice that these chapters do not contain
exhaustive documentation describing every function and class in the Standard
C++ library. We ve left the full descriptions to others; in particular to P.J. Plauger s Dinkumware C/C++ Library Reference at https://www.dinkumware.com.
This is an excellent online source of standard library documentation in HTML format that you can keep resident on your computer and view with a
Web browser whenever you need to look something up. You can view this online or
purchase it for local viewing. It contains complete reference pages for the
both the C and C++ libraries (so it s good to use for all your Standard C/C++
programming questions). Electronic documentation is effective not only because
you can always have it with you, but also because you can do an electronic
search.
When you re actively programming, these resources should
satisfy your reference needs (and you can use them to look up anything in this
chapter that isn t clear to you). Appendix A lists additional references.
The first chapter in this section introduces the Standard
C++ string class, which is a powerful tool that simplifies most of the
text-processing chores you might have. Chances are, anything you ve done to
character strings with lines of code in C can be done with a member function
call in the string class.
Chapter 4 covers the iostreams library, which
contains classes for processing input and output with files, string targets,
and the system console.
Although Chapter 5, Templates in Depth, is not explicitly
a library chapter, it is necessary preparation for the two chapters that
follow. In Chapter 6 we examine the generic algorithms offered by the Standard
C++ library. Because they are implemented with templates, these algorithms can
be applied to any sequence of objects. Chapter 7 covers the standard
containers and their associated iterators. We cover algorithms first because
they can be fully explored by using only arrays and the vector container
(which we have been using since early in Volume 1). It is also natural to use
the standard algorithms in connection with containers, so it s good to be
familiar with the algorithms before studying the containers.