Convert vector of vector of bools to pointer of pointers

  c++, c++11, raw-pointer, vector

I have a problem similar to the one mentioned in the question Convert vector of vector to pointer of pointer.

The only difference is that I have to use booleans instead of shorts.

But if I compile this code:

#include <vector>

/* C like api */
void foo(bool **psPtr, const int x, const int y);

int main()
  const int x = 2, y = 3;
  std::vector<std::vector<bool>> vvsVec(x, std::vector<bool>(y, 0));
  std::vector<bool *> vpsPtr(x, nullptr);

  /* point vpsPtr to the vector */
  int c = 0;
  for (auto &vsVec : vvsVec)
    vpsPtr[c++] =;

  /* api call */
  foo(, x, y);

  return 0;

I get the following error:

./dummy/main.cpp:15: error: assigning to
‘__gnu_cxx::__alloc_traits<std::allocator<bool *> >::value_type’ (aka
‘bool *’) from incompatible type ‘void’


./dummy/main.cpp:15: error: void value not ignored as
it ought to be
vpsPtr[c++] =;

Please, can someone explain me what I’m doing wrong and how to fix this?


Source: Windows Questions C++