Hey, I can’t find clear platform limitations when it comes to newer standards and dynamic allocations in c++.
I have Seeed wio terminal and I’ve used unique_ptr here, but trying to use vector ends with a ton of errors. Isn’t this supported here, can I find information about it somewhere?
Maybe someone have a solution? I tried with and without flags.
The long C++ error messages are blinding you. The smoking gun here was
c:\users\max\.platformio\packages\toolchain-gccarmnoneeabi@1.70201.0\arm-none-eabi\include\c++\7.2.1\bits\stl_algobase.h: In static member function 'static bool __lexicographical_compare<true>::__lc(const _Tp*, const _Tp*,
const _Up*, const _Up*)':
.pio\libdeps\seeed_wio_terminal\Seeed_Arduino_LCD/TFT_eSPI.h:304:19: error: expected unqualified-id before '(' token
#define min(a, b) (((a) < (b)) ? (a) : (b))
^
In file included from c:\users\max\.platformio\packages\toolchain-gccarmnoneeabi@1.70201.0\arm-none-eabi\include\c++\7.2.1\vector:60:0,
from src\main.cpp:8:
c:\users\max\.platformio\packages\toolchain-gccarmnoneeabi@1.70201.0\arm-none-eabi\include\c++\7.2.1\bits\stl_algobase.h: In function 'bool __lexicographical_compare_aux(_II1, _II1, _II2, _II2)':
The TFT_eSPI.h library is injecting the min and max macros into your translation unit, but that majorly screws up the std::min() and std::max() templates, which are needed for the comparison algorithms defined in stl_algobase.h that is pulled in by vector.
So really what you need to do is
#include "DateTime.h"
#include "RTC_SAMD51.h"
#include "TFT_eSPI.h"
#include <Arduino.h>
// don't screw up STL header code by defining min and max as macros
#undef min
#undef max
#include <vector>
See
See also
P.S.: It also has the same effect when you reorder the include files, so that min() as defined by TFT_eSPI.h is not seen by the code included by vector:
#include <Arduino.h>
#include "DateTime.h"
#include "RTC_SAMD51.h"
#include <vector>
#include "TFT_eSPI.h" // must come after vector include
but this is less intuitive and breaks easily if someone reorders the includes.