Hello

I have a problem with a part of my binary heap i am building for my a* (pathfinding) project.
The program crashes on this line with debug assertion failed message, expression: (_BLOCK_TYPE_IS_VALID(pHead->nBlockUse)):

Comparable temp = theHeapsArray[hole];

I have tried creating my heap with integers and it worked.

But when i try to create a BinaryHeap<HeapEntry> it fails on that (see code) line.
I have overloaded operator<() and operator>() in my "HeapEntry" struct. Do i have to do something else with it to be able to assign a comparable variable as a HeapEntry?

Tell me if u want more code.

Would appreciate any help as i just started programming in c++ a few weeks ago.

I think the problem was that HeapEntry contained a pointer that i deleted in HeapEntries destructor. When the Comparable temp went out of scope it got deleted unintentionally, or something like that.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.