Questions tagged [stl]

9 questions
11
votes
4 answers

Is the C++ STL fully supported on Arduino?

I don't yet own an Arduino board to run code on, and as the title says, I'm curious if the C++ STL is fully supported on Arduino and already part of the Arduino IDE. The STL is probably the most efficient, fully tested, and resource-minimal (which…
NonCreature0714
  • 213
  • 1
  • 2
  • 7
6
votes
1 answer

How can I make std::cout write to Serial?

I'm using an Arduino MKR WiFi 1010, a SAMD ARM Cortex M3 board. I rely on the standard library a lot, using things like std::vector<> and std::string. I also want to use std::cout. I've managed to do this on an UNO R3 using the ArduinoSTL library,…
Tim Long
  • 305
  • 3
  • 12
6
votes
1 answer

Is there any working analogue to the pair std::function and std::bind in Arduino?

Both ArduinoSTL and StandardCplusplus don't support them. They implement the version that is compatible with c++03 (not c++11). This functionality is handy when you design libraries that work with callbacks. And you do need them, if your Arduino…
Adam Ryczkowski
  • 279
  • 1
  • 5
  • 16
5
votes
1 answer

Current Arduino STL Libraries

I was going to update this question but I thought that this was different. I have been trying to get std::vector to work with the latest Arduino. I have tried downloading several libraries found online but I can not get one of them to compile…
Andy Braham
  • 468
  • 1
  • 8
  • 17
2
votes
1 answer

Is std::array (from the C++ STL) safe to use on arduino? Does it use dynamic memory allocation?

I'd like to use std::array on a project that will need to be very stable, and have all memory pre-allocated to avoid heap fragmentation. I am reading in characters from the serial port, following a known protocol. Each received byte will be written…
Mustard Tiger
  • 33
  • 1
  • 5
1
vote
1 answer

How do I use lambda functions in Arduino?

I want to pass a lambda function as an argument to a method. Example: T reduce(const T initial, const std::function acc) { T value = initial; for (size_t i = 0; i < S; ++i) { value = acc(value, this->values[i]); } …
Arseni Mourzenko
  • 246
  • 1
  • 3
  • 11
1
vote
1 answer

Dynamically create functions for AccelStepper that use Adafrut_StepperMotor.oneStep methods?

In the Adafruit_MotorShieldV2Library>Accel_MultiStepper example, AccelSteppers are initialized using the following static forwardstep1 and backwardstep1: #include #include #include //First, get an…
1
vote
1 answer

How to declare a Dynamic Array?

I want to define an unknown size for an array. However, I know that this cannot be done on the arduino. So what other methods do you suggest? I tried using vectors by downloading the library ArduinoSTL, but it doesnt work. (It only prints…
0
votes
1 answer

Can I use STL on an Arduino Uno?

I started using an Arduino Uno days ago. I'm an experienced C++ dev and I'm kind of confused. Is the Arduino compiler different than a C++ one? What C++ version does Aruidno Uno use? Why it doesn't it support STL? Is it possible to use STL? Also,…
ZakiMkn
  • 19
  • 3