Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Yes,. chances are you're mixing the Release and Debug versions of the runtime library. </p> <p>On Windows (only AFAIK) there are 2 different runtime libraries, the release version does memory allocs as you'd expect, but the debug one adds guard blocks around all allocations so it can track buffer overflows and other memory errors. The problem with this system is that if you mix a Release and a Debug library in the same application, you will allocate (say) 10 bytes in Release and then free 18 bytes (4+10+4) in Debug. </p> <p>The trick is to build and link either all Debug or all Release, every time. Alternatively, if you must use a Release lib in a debug build, then you <em>must</em> ensure that all allocations made in a dll is also freed by that same library - do not allow the CRT new/delete routines to be used, wrap them in a function. this ensures that the 10 byte alloc in dll A will be freed by the same dll, which obviously will only delete the 10 bytes.</p> <p>EDIT:</p> <p>ok, if it's not that, then looking at the call stack shows the error when allocating a new vector using the copy constructor (line 32 of Dequeue), so firstly split that line into 2 statements so you can see if its the copy, or the pop that's causing the problem (I always tend to put a debug statement between them just to make really sure you know which line is the problem).</p> <p>Your sample code shows 2 different ways of accessing the queue ->Enqueue and .Dequeue which suggests more complexity in the queue itself.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload