Not asking about <string>
but about the Standard-Library as a whole for use on micro-controllers.
I don't yet own an Arduino board to execute code on, and as the title says, I'm curious if the C++ Standard-Library is fully supported on Arduino and already part of the Arduino IDE. It really goes without saying that the Standard-Library is probably the most efficient, fully tested, and resource-minimal publicly available C++ code out there, and would make life much easier to code for micro controllers like Arduino.
Or, am I missing the point of Arduino/micro-controllers somehow? That, because their resources are so limited, most code has to be completely tailored to a specific function, and not generic or templatized?
If the Standard-library is not a part of Arduino IDE, then how can I include specific libraries such as <algorithm>
and <bitset>
?
Arduino is quite different from other embedded system projects. For one thing, it uses its own language based on C/C++. For another thing, you're dealing with incredible specialized software where it's unlikely that you'll need the heavy abstraction of <string>
or <bitset>
. Contrast with say a homebrew kernel, where you're dealing with desktop-grade hardware and the standard library aids development. Further, homebrew kernels eventually want to become "self-hosted", that is they can port GCC and libstdc++ to userspace. Again, this is something you're not going to see in an Arduino context.
Now when you're talking about the libraries that come with Arduino, it's a completely different story. These are written in C or C++ and could benefit from a ported standard library, but it's unlikely to be helpful. Porting the STL is no easy task and it is very, very big. Most of the functionality is much more than necessary - do you really need a <string>
or <bitset>
to read or write bytes to a port? Then think about the cost and complexity from a developer point of view: the Arduino developers are going to take on this arduous (pun not intended) task to implement it, and support it when most of it is going to be unused or ripped out (think custom allocators.)
And one final point, there are a plethora of Arduino boards out there with different specs. The standard library is an abstraction built on top of an existing C library. At one point, you're going to have to get down and dirty and actually write the code for the C library and runtime, making the standard library inherently unportable (think libstdc++-arm-none-eabi-newlib).
Now if you're unhappy with this, you can still port a subset of the STL by following their tutorial on writing your own library for Arduino.