Hey guys,
I just tried to initialize an array of a class or a function with an initializer list. This feature is part of c++11 and should be supported by Arduino IDE?!? Can someone explain why this first minimum example is not working? I have compiled the same Code with MinGW (see second example) and it just works fine :-/
Thanks so much!
Example 1:
void my_func(const initializer_list<int>& init)
{
}
void setup()
{
}
void loop()
{
my_func({1,2,3});
}
compiled with Arduino IDE --> Error:
exit status 1
'initializer_list' does not name a type
Example 2:
#include <iostream>
void my_func(const std::initializer_list<int>& init)
{
std::cout << init.size() << std::endl;
}
int main()
{
my_func({1,2,3});
return 0;
}
compiled with MinGW --> works fine!