Book Image

Learning Boost C++ Libraries

By : Arindam Mukherjee
Book Image

Learning Boost C++ Libraries

By: Arindam Mukherjee

Overview of this book

Table of Contents (19 chapters)
Learning Boost C++ Libraries
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Boost Container library


The Boost Container library implements majority of the STL container templates in addition to providing a few nifty nonstandard containers. So, what is the point of reimplementing STL containers? To understand this, let us look at what kind of objects can be stored in STL containers and what kind cannot be.

To store objects of type T in a std::vector, for example, the type T must be a complete type (that is, must be completely defined, not just declared) at the point where the object of type std::vector<T> is defined. Moreover, in pre-C++11, objects of type T must be copyable and assignable. These requirements generally hold for other STL containers besides std::vector. In general, till before C++11, STL was a copy-intensive framework: you copied objects into STL containers to store them, the containers copied them around while being resized or restructured, and the containers destroyed those copies when they went out of scope. Copying being an expensive operation...