Embedded rework of C++ STL logo

Embedded rework of C++ STL

Free

`basic_string`, `basic_ostream` etc. leaned way down. Cross platform (including AVR).

FreeFree tier
Type
Open Source

About Embedded rework of C++ STL

estdlib is a C++ standard library implementation specifically adapted for embedded environments. It provides a lightweight, header-only library that follows a layered design (layer1-layer3) to offer explicit memory management without dynamic allocation or virtual functions. The library includes components such as character conversion (from_chars/to_chars), chrono primitives with FreeRTOS clock support, functional utilities, locale with multiple languages, optional, IO streams (ostream/istream) with non-blocking behavior, circular queues, vectors, and span/buffer views. It is cross-platform, including support for AVR microcontrollers, and aims to enable standard-like features as early as C++11, with some features available in C++98.

Key Features

No virtual functions or dynamic allocation; uses template metaprogramming for efficiency
Character conversion (charconv) for integer conversions (from_chars/to_chars)
Chrono primitives with FreeRTOS clock implementation
Functional: estd::detail::function with low-level memory management
Locale: template-based with multiple languages and character sets, non-blocking num_get
Optional with layer1 variants for reduced memory footprint
IO streams (ostream/istream) with non-blocking behavior and streambuf class
Circular queue (layer1::deque) and priority_queue for embedded use
Vectors following layer1-layer3 paradigm for flexible allocation
Span with const_buffer and mutable_buffer inspired by Boost

Pros & Cons

Pros
  • Eliminates dynamic allocation and virtual functions, reducing memory overhead and improving determinism
  • Highly portable across embedded platforms including AVR, ARM, and others
  • Supports C++11 and even some C++98 features for legacy compilers
  • Explicit memory management layers (layer1–layer3) provide control over allocation
  • Non-blocking I/O design suitable for real-time and interrupt-driven environments
  • Includes practical utilities like circular queues and optional with low overhead
Cons
  • Reduced robustness compared to full std:: implementation (e.g., streams are lighter but less feature-rich)
  • Non-standard implementations may require adaptation for developers accustomed to std::
  • Limited simultaneous locale support (only one locale at a time due to template-based approach)
  • Smaller community and documentation compared to the official C++ Standard Library

Best For

Embedded systems development (microcontrollers, AVR, ARM Cortex-M)Real-time systems where dynamic allocation is forbiddenIoT devices with limited memory and processing powerCross-platform embedded projects requiring a subset of C++ standard featuresProjects needing non-blocking I/O in constrained environments

FAQ

Does estdlib use dynamic memory allocation?
No, estdlib explicitly avoids dynamic allocation. It uses fixed buffers and template-based memory management to suit embedded environments.
Is estdlib compatible with Arduino or AVR microcontrollers?
Yes, estdlib targets AVR and other platforms. It has been tested on AVR and includes features like priority_queue specifically for those environments.
What C++ standards does estdlib support?
All features are available in C++11, and some features are available in C++98. The library aims to enable standard-like features as early as possible.
Does estdlib include support for FreeRTOS?
Yes, it includes a freertos_clock implementation in the chrono component for use with FreeRTOS.