C++ is a great language to use for embedded applications and templates are a powerful aspect of it. The standard library
can offer a great deal of well tested functionality, but there are some parts that do not fit well with deterministic behavior
and limited resource requirements. These limitations usually preclude the use of dynamically allocated memory which
means that the STL containers are unusable.
What is needed is a template library where the user can declare the size, or maximum size of any object upfront. As most
embedded compilers do not currently support the standard beyond C++ 03, it would also be nice to have access to some
of the features introduced in the later library.
The ETL is not designed to completely replace the STL, but complement it. Its design objective covers four main areas.
• Create a set of containers where the size or maximum size is determined at compile time.
These containers should be largely equivalent to those supplied in the STL, with a compatible API.
• Be compatible with C++ 03 but implement as many of the C++ 11 additions as possible.
• Have deterministic behaviour.
• Add other useful components that are not present in the standard library.
The embedded template library has been designed for lower resource embedded applications. It defines a set of
containers, algorithms and utilities, some of which emulate parts of the STL. There is no dynamic memory allocation. The
library makes no use of the heap. All of the containers (apart from intrusive types) have a fixed capacity allowing all
memory allocation to be determined at compile time. The library is intended for any compiler that supports C++ 03.
• MIT licence
• No dynamic memory allocation. All storage is declared either at compile time or on the stack.
• No RTTI required
• Very little use of virtual functions. They are used only when they are absolutely necessary for the required
• A set of fixed capacity containers. array, bitset, deque, forward_list, list, queue, stack, vector, map, set, etc.
• As the storage for the container types is allocated as a contiguous block, they are extremely cache friendly
• Reduced container code size through use of base classes dependant on type only.
• Templated compile time constants
• Templated design pattern base classes (Visitor, Observer)
• Frameworks for message routing, finite state machines and task scheduling.
• Reverse engineered C++ 0x11 features (type traits, algorithms, containers etc.)
• Type-safe smart enumerations
• Type-safe typedefs + constants
• 8, 16, 32 & 64 bit CRC calculations
• Checksums & hash functions
• Variants (a type-safe union)
• Choice of asserts, exceptions, error handler or no checks on errors (see here)
• Many utilities for template support.
• Unit tested (currently over 2000 tests)
• Easy to read and documented source
• Free email support
• Continuous integration testing.
Any help porting the library to work under different platforms and compilers would be gratefully received.
I am especially interested in people who are using Keil, IAR, Green Hills, TI Code Composer etc, bare metal or RTOS, and DSPs.