| Home | Libraries | People | FAQ | More

## Chapter 8. Boost.Container

### Ion Gaztanaga

Copyright © 2009-2015 Ion Gaztanaga

Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

## Introduction

Boost.Container library implements several well-known containers, including STL containers. The aim of the library is to offers advanced features not present in standard containers or to offer the latest standard draft features for compilers that don't comply with the latest C++ standard.

In short, what does Boost.Container offer?

- Move semantics are implemented, including move emulation for pre-C++11 compilers.
- New advanced features (e.g. placement insertion, recursive containers) are present.
- Containers support stateful allocators and are compatible with Boost.Interprocess (they can be safely placed in shared memory).
- The library offers new useful containers:
  - `flat_map`, `flat_set`, `flat_multimap` and `flat_multiset`: drop-in replacements for standard associative containers but more memory friendly and with faster searches.
  - `stable_vector`: a std::list and std::vector hybrid container: vector-like random-access iterators and list-like iterator stability in insertions and erasures.
  - `slist`: the classic pre-standard singly linked list implementation offering constant-time `size()`. Note that C++11 `forward_list` has no `size()`.

### Building Boost.Container

There is no need to compile Boost.Container, since it's a header-only library, just include your Boost header directory in your compiler include path except if you use:

- Extended Allocators
- Some Polymorphic Memory Resources classes.

Those exceptions are are implemented as a separately compiled library, so in those cases you must install binaries in a location that can be found by your linker. If you followed the Boost Getting Started instructions, that's already been done for you.

### Tested compilers

Boost.Container requires a decent C++98 compatibility. Some compilers known to work are:

- Visual C++ >= 7.1.
- GCC >= 4.1.
- Intel C++ >= 9.0

Last revised: May 05, 2016 at 21:18:31 GMT |