A C++ template library for embedded applications
MIT licensed
Designed and
maintained by
John Wellbelove
Support the development
of the ETL
Containers

The library defines a set of containers that have been specially tailored for embedded systems.
They have a maximum capacity fixed at compile time and make no calls to malloc/free or  new/delete.
They are completely deterministic.

Most container types have been designed to mimic, as far as possible, those found in the STL. Some do not have
direct STL equivalents.

As the storage for all of the container types is allocated as a contiguous block, they are extremely cache friendly.

Note: In the ETL vector<bool> really is a container and actually does contains bool.

Intrusive containers
There are intrusive versions of certain containers. These do not store copies of the inserted values, but link to the
original objects. Certain types of intrusive container require that the stored object derives from an intrusive link.
Most intrusive containers do not have a maximum fixed capacity.
See here for more information.

To eliminate code bloat, most container templates utilise 'hoisting' where functionality, independent of the size
and/or type, is separated out in to base classes.

For example, vector<int, 5> and vector<int, 10> will share code from ivector<int>.
vector<int, 5>, vector<float, 7> and vector<int, 10> will all share code from vector_base.

The 'i' prefixed container types may be used as size independent pointer or reference types for all sizes of the
derived type.

etl::vector<int, 5>  vector1;
etl::vector<int, 10> vector2;

etl::ivector<int>* pvector;

pvector = &vector1;
pvector->push_back(3);

pvector = &vector2;
pvector->push_back(4);

Move semantics and rvalue references
The following containers support rvalue references and move semantics.

vector
deque
list
forward_list
flat_set
flat_multiset
flat_map
flat_multimap

More to follow.

Differences from the STL containers
As the containers have a fixed capacity, most also implement full() and available() member functions.

Any member functions that require rvalue references are not supported (except for those listed above).

Most of the containers allocate their storage from an internal instance of etl::pool.
Because of this the containers have a certain set of attributes that differ from the standard library.

• The storage for all containers is contiguous, thereby enhancing cache hits.
• No heap memory is used; no OS or user supplied memory management is required.
• Non-static containers declared locally within functions will store their contents on the stack.
• Copying or swapping a container is not a low cost action, as all of the contents will be copied (except for
externally buffered vectors which will use a simple pointer copy).

Notes
Although the containers utilise inheritance, like the STL containers, they are not intended to be used
polymorphically.
ETL containers are not virtual (unless enabled by a compile time macro ETL_POLYMORPHIC_XXX, see Macros).