I'm having a simple issue with std :: fill
.
First I define a 2-dimensions array of pairs.
const int NMAX = 13;
typedef pair<int, set<int>> solution;
solution memo[NMAX][NMAX];
I assume that at that stage my array is initialized with default pair constructor. Then, I would like to initialize this array without relying on a nested loop. What I am doing is this:
solution s;
s.first = -1;
std::fill( &memo[0][0], &memo[0][0] + sizeof(memo), s);
But I get a bus error... What am I doing wrong?