Im using vc++ 2005 express and while running a program i get an assertion failure and the debugger breaks at the indicated line of code with the message:

_BLOCK_TYPE_IS_VALID(pHead->nBlockUse)

indicating a corrupted heap apparently

from what ive read, this is a problem with deleting a pointer more than once, or perhaps deleting a pointer that points somewhere unexpected and not "owned" by the object calling the delete on that pointer

EDIT:
I just solved the problem by ensuring i had copy constructors and operator= defined for all objects that were being passed 'by value' in my program as well as those objects i put into STL containers, i thought i might leave this up here incase someone else comes across the same error.

and since ive already got this post up here (rather than bumping the original), i wanted to say thanks to weaknessforcats for the help previously with the visitor pattern, i used those references you provided and came up with a scaled down version of it that worked perfectly :D