On Oct 1, 9:31 pm, andrey....@gmail.com wrote:
> On Oct 1, 8:01 pm, "Alf P. Steinbach" <al...@start.no> wrote:
>
>
>
>...
> //get all available options for value val
> vector<u8> *options(u16 val) {
> vector<u8> *cc = new vector<u8>();
According to my debugging, ^this^ line is throwing std::bad_alloc due
to a null pointer being returned from malloc. What is weird is that I
am allocating only 1 vector and I have 1 GB of ram so why is malloc
returning null?
Call trace:
[OS-dependent stuff]
C++ library!malloc()
C++ library!operator new()
sudoku![std::vector allocate]
sudoku!std::vector::insert
sudoku!std::vector::push_back
sudoku!solver::options
....
sudoku!main
....
> u8 i;
> //find and add avialbale numbers
> for (i = 0; i < 9; ++i)
> if (((1 << i) & val) == 0)
> cc->push_back(i + 1);
> return cc;
> }
> ...