Wednesday, June 09, 2004

Re: N-queens solution

Ok, my favourite part when I was doing this was when I tried to make my own version of the standard library function mem_fun_ref_t. You'll will know it as mem_fun_ref, which is basically an adapter for the first!

Now what I was trying to do was to get for_each() working in this way,


But it would let me, saying that address of setatt couldn't be taken. Then I tried

for_each(currSol.begin(),currSol.end(),mem_fun_ref, (&ChessBoard::setatt))

This was really bad, cause as I later found out, my whole idea of what the adapters mem_fun and mem_fun_ref did was wrong.

Mohnish, this is especially for you, man try reading the source for stl_function.h !! You'll learn an awful lot about the way things work! try stl_algorithm.h too! But it's not for the faint-hearted!! :):) I thought I knew exactly what it did, but I was a bit wrong! It was time well spent trying to read it!!

I tried making my own version of mem_fun_ref, but there were problems and I wasn't able to get it right, yet!!

If you guys want I'll post explanations of mem_fun & mem_fun_ref! Tell me if you want it! Atleast I'll try, I'm still figuring out :)


No comments: