avr-libstdcpp contains the complete libstdc++ headers, but only a few sources of the compiled library. Everything that is implemented in the headers works, everything that requires the compiled library fails to link.
Everything that is implemented in templates or inline functions, for example:
- Containers:
array,vector,deque,list,forward_list,map,set,unordered_map,unordered_set,queue,stack,bitset,span - Strings:
string,string_view,to_chars,from_chars,to_string - Algorithms and ranges:
<algorithm>,<numeric>,<ranges> - Utilities:
optional,variant,any,expected,tuple,function,unique_ptr,bit,ratio,type_traits,concepts,compare <chrono>durations, time points and calendar types<cmath>,<complex>,<numbers>,<random>(exceptrandom_device)<atomic>with the runtime- Coroutines
The integration tests show more examples.
These features require the compiled library, so they fail to link:
- I/O streams (
<iostream>,<sstream>,<fstream>) - Locales (
<locale>) - Formatting (
<format>,<print>) std::random_device- The time zone database of
<chrono> - Threads (
<thread>,<mutex>,<condition_variable>): there is no operating system - Filesystem (
<filesystem>)
These are disabled on purpose:
- Exceptions and RTTI are not supported. Compile with
-fno-exceptions -fno-rtti. Errors that would throw an exception callabort(), see getting started. - The mathematical special functions of C++17 (
std::beta(),std::legendre(), …) are disabled, since they are implemented in the TR1 headers, which are not included. - Wide characters (
wchar_t,<cwchar>,<cwctype>) are not supported by avr-libc. - The
<cfenv>and<ctgmath>headers, since avr-libc has no<fenv.h>and<tgmath.h>. - Some C99 functions of
<cstdlib>and<cstdio>that avr-libc does not implement, such asstd::lldiv()andstd::vsscanf().
intandsize_tare only 16-bit wide, which limits the size of containers and the range of many algorithms.-mint8is not supported.doubleis only 32-bit wide by default, the same asfloat. Since avr-gcc 10long doubleis 64-bit and is implemented in software by libgcc, which is much slower and larger.- Dynamic memory is very limited: an ATmega328P has only 2kB of RAM. Consider
containers with a fixed capacity like
std::array, or custom allocators. avr-libc'sprintf()does not support floating-point numbers by default.- The
__int24and__uint24types of avr-gcc are not recognized by<type_traits>.