Skip to content

Conversation

ngraziano
Copy link

std::array<int,5> test={ 1 };
should fill element 1 to 4 with 0;

In other library the member data element is public
to allow compiler to fill it directly.
Use same principle.

A code example that test this:

#ifdef ARDUINO
#include <ArduinoSTL.h>
#endif

#include <array>
#include <iostream>

std::array<int16_t, 8> test_array;

void test()
{
  test_array = {0, 1, 2, 3, 4, 5, 6, 7};
  std::cout << "Value shoud be 0 1 2 3 4 5 6 7  : ";
  for (auto values : test_array)
  {
    std::cout << values << " ";
  }
  std::cout << std::endl;

  test_array = {5, 5};

  std::cout << "Value shoud be 5 5 0 0 0 0 0 0  : ";
  for (auto values : test_array)
  {
    std::cout << values << " ";
  }
  std::cout << std::endl;
}

#ifdef ARDUINO
void setup()
{
  Serial.begin(115200);
}

void loop()
{
  test();
}
#else
int main(int argc, char **args)
{
  while(true)
    test();
}
#endif

std::array<int,5> test={ 1 };
should fill element 1 to 4 with 0;

In other library the member data element is public
to allow compiler to fill it directly.
Use same principle.

# Conflicts:
#	src/array
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant