I'm working with a custom C++ library, CPSTL, for Arduino, which includes a cpstd::vectorcpstd::vector
class that is designed to work with cpstd::initializer_listcpstd::initializer_list
, cpstd::initializer_listcpstd::initializer_list
is supposed to mimic std::initializer_liststd::initializer_list
.
However, I'm having trouble initializing a cpstd::vectorcpstd::vector
using brace-enclosed initializer lists.
I've looked up many sources online, and it seems there is not a lot of information in the topic, but came up to things such as FastArduino: initializer list, and Arduino STL: Initializer list. Giving me hopes that it is actually possible. (I can't use those libraries, because they lack the build system generation tools on the library I am developing, they also lack on customizability,and and also as a good learning experience)
could not convert '{0, 1, 2, 3, 4}' from 'brace-enclosed initializer list' to 'cpstd::vector<unsigned char>'.
could not convert '{0, 1, 2, 3, 4}' from 'brace-enclosed initializer list' to 'cpstd::vector'.
cpstd::vector<unsigned char> myVector = {0, 1, 2, 3, 4};
cpstd::vector<unsigned char> myVector = {0, 1, 2, 3, 4};
I have already implemented a custom cpstd::initializer_listcpstd::initializer_list
and constructor that should handle this, but the issue persists. Is there something specific to the Arduino environment that could be causing this issue?
I have verified that the cpstd::initializer_list
cpstd::initializer_list
is correctly defined and included in my code.The cpstd::vector
cpstd::vector
class is included and accessible.I have reviewed my cpstd::vector
cpstd::vector
class, and the constructor for cpstd::initializer_listcpstd::initializer_list
is correctly implemented.While reading the error log, I noticed that std::initializer_list
std::initializer_list
constructor has two parameters, a pointer to the data, and also a variable telling the length of the braced enclosed list, however I noticed that the list ends up casting to a single parameter, hence having no possible constructor to call
What could be causing this issue, and how can I resolve it to initialize cpstd::vectorcpstd::vector
using brace-enclosed initializer lists in the Arduino environment? I think the maainmain issue is with boards that have no STL support. (i.e. AVR based boards)