• Home
Name Date Size #Lines LOC

..--

doc/12-May-2024-2,9972,239

example/12-May-2024-1,4991,019

meta/12-May-2024-6657

test/12-May-2024-4,0063,129

README.mdD12-May-20242.6 KiB3425

index.htmlD12-May-2024711 2113

test_results.svgD12-May-20243 KiB2626

README.md

1# Boost PolyCollection library
2
3Branch   | Travis | AppVeyor | Regression tests
4---------|--------|----------|-----------------
5develop  | [![Build Status](https://travis-ci.org/boostorg/poly_collection.svg?branch=develop)](https://travis-ci.org/boostorg/poly_collection) | [![Build Status](https://ci.appveyor.com/api/projects/status/github/boostorg/poly_collection?branch=develop&svg=true)](https://ci.appveyor.com/project/joaquintides/poly-collection) | [![Test Results](./test_results.svg)](https://www.boost.org/development/tests/develop/developer/poly_collection.html)
6master   | [![Build Status](https://travis-ci.org/boostorg/poly_collection.svg?branch=master)](https://travis-ci.org/boostorg/poly_collection) | [![Build Status](https://ci.appveyor.com/api/projects/status/github/boostorg/poly_collection?branch=master&svg=true)](https://ci.appveyor.com/project/joaquintides/poly-collection) | [![Test Results](./test_results.svg)](https://www.boost.org/development/tests/master/developer/poly_collection.html)
7
8**Boost.PolyCollection**: fast containers of polymorphic objects.
9
10[Online docs](http://boost.org/libs/poly_collection)
11[Seminal article at bannalia.blogspot.com](http://bannalia.blogspot.com/2014/05/fast-polymorphic-collections.html)
12
13Typically, polymorphic objects cannot be stored *directly* in regular containers
14and need be accessed through an indirection pointer, which introduces performance
15problems related to CPU caching and branch prediction. Boost.PolyCollection
16implements a
17[novel data structure](http://www.boost.org/doc/html/poly_collection/an_efficient_polymorphic_data_st.html)
18that is able to contiguously store polymorphic objects without such indirection,
19thus providing a value-semantics user interface and better performance.
20Three *polymorphic collections* are provided:
21
22* [`boost::base_collection`](http://www.boost.org/doc/html/poly_collection/tutorial.html#poly_collection.tutorial.basics.boost_base_collection)
23* [`boost::function_collection`](http://www.boost.org/doc/html/poly_collection/tutorial.html#poly_collection.tutorial.basics.boost_function_collection)
24* [`boost::any_collection`](http://www.boost.org/doc/html/poly_collection/tutorial.html#poly_collection.tutorial.basics.boost_any_collection)
25
26dealing respectively with classic base/derived or OOP polymorphism, function wrapping
27in the spirit of `std::function` and so-called
28[*duck typing*](https://en.wikipedia.org/wiki/Duck_typing) as implemented by
29[Boost.TypeErasure](http://www.boost.org/libs/type_erasure).
30
31## Requirements
32
33Boost.PolyCollection is a header-only library. C++11 support is required. The library has been verified to work with Visual Studio 2015, GCC 4.8 and Clang 3.3.
34