#include <array>
#include <string.h>
#include <stdio.h>
using bar = struct bar
{
int x;
char y;
};
auto main() -> int
{
std::array<bar [3], 4> foo;
bar myBar [3] = { { 1, 'a'}, { 2, 'b'}, {3, 'c'} };
// Compiler error "Invalid array assigment"
//foo [0] = myBar;
// This works and foo [0] has also the correct content
memcpy( foo [0], myBar, sizeof(myBar) );
for ( auto const & fooBar : foo [0] ) {
printf( "x=%d - y=%c\n", fooBar.x, fooBar.y );
}
return 0;
}