Matrix of supported C++ feature sets per platform

Does anyone know of any resources detailing exactly what C++ language and library features are supported by the different Arduino platforms? I'm writing a library and want to use the STL but it looks like it's not supported everywhere (such as the more-limited older devices like the Uno), among other things. Would love to have a matrix of feature-sets so I can make an informed decision as to which platform(s) to target and which to exclude. Thank you!

STL is supported for all platform - it can't tell the difference between an UNO a PC or a MAC

Mark

Hi Mark,

Thanks for the response! However, I don’t see how that can be true both from a theoretical perspective (the STL is far too large for some of the most limited-resource Arudino platforms) as well as an experimental one, as you can see here when I try to build a library that uses std::vector for the Uno (using IDE v1.8.8 ):

In file included from /home/ryan/Arduino/libraries/Redis_for_Arduino/Redis.cpp:2:0:
/home/ryan/Arduino/libraries/Redis_for_Arduino/RedisInternal.h:6:15: fatal error: map: No such file or directory
compilation terminated.
exit status 1
Error compiling for board Arduino/Genuino Uno.

The sketch I’m attempting to build is the simplest-possible that causes this build failure:

#include <Redis.h>

void setup() {}

void loop() {}

The library I’m trying to build against is this one, and is specifically this include of std::map that is causing the compilation to fail.

This code builds fine for the ESP8266 and ESP32 platforms, so clearly there is some differentiation in STL support between platforms or I’m doing something wrong.

There are some 3rd party STL libraries for the AVR boards you can install: https://github.com/mike-matera/ArduinoSTL

STL predates both micro anythings and PC's, it really just makes use of the pre-processor to create code. It is both language and target system independent.

Mark

BY the way as far as I know "redis" is NOT PART OF THE STL

Mark

Theoretically there's no reason not to support STL. The impact of STL on your executable size depends on how much, which parts, how you use STL and which STL implementation. If you don't use it at all, there's obviously no impact. If you use say only std::pair, the impact is minimal (you would probably have the size overhead anyway with an alternative solution).

I don't know the history of it, but I can only guess that they probably don't support STL because for newbies it's quite easy to run into memory and executable size issues with it with the limited memory of many of the Arduino MCU's when you don't understand the details (e.g. template code bloat and dynamic memory allocation/fragmentation).

Regarding your original question, I don't know of any feature matrix, but from my experience, besides the lack of STL, you are using GCC and thus whatever other C++ features the compiler supports. I believe GCC that ships with the latest Arduino development environment is 5.4 which supports C++14.

pert: There are some 3rd party STL libraries for the AVR boards you can install: https://github.com/mike-matera/ArduinoSTL

This is fantastic, thank you very much for the link! I should've thought to just google it, d'oh :)

JarkkoL: Theoretically there's no reason not to support STL. The impact of STL on your executable size depends on how much, which parts, how you use STL and which STL implementation. If you don't use it at all, there's obviously no impact. If you use say only std::pair, the impact is minimal (you would probably have the size overhead anyway with an alternative solution).

Yeah that was exactly my thinking, I knew there'd be a limit to what was available but figured that as long as I kept my usage minimal (both in classes used and types targeted) I figured it'd be workable. Thanks for the insight, much appreciated!

holmes4: BY the way as far as I know "redis" is NOT PART OF THE STL

I'm using the STL to develop a library that interfaces with Redis.

Also, there's no need to shout Mark.

You're welcome. I'm glad if I was able to be of assistance. When you're used to always having these features available by default, you probably don't expect to need to install something, just as I would be quite surprised to find that I needed to install a library to use if.

Enjoy! Per