Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>The simplest code I can come up with to reproduce this error looks like this:</p> <pre><code>#include &lt;list&gt; int main() { std::list&lt;int&gt; mylist; mylist.pop_front(); } </code></pre> <p>I can prevent the error by doing:</p> <pre><code>#include &lt;list&gt; int main() { std::list&lt;int&gt; mylist; if (!mylist.empty()) { mylist.pop_front(); } } </code></pre> <p>You're calling:</p> <pre><code>myList.pop_front(); </code></pre> <p>...within a <code>while</code>-loop, which in turn is within a <code>while</code>-loop that also calls <code>myList.pop_front()</code>.</p> <p>I can only suggest that you debug your code to see how many times <code>pop_front()</code> is invoked for <code>mylist</code>. My money is on it being more than <code>mylist.size()</code> times, <a href="https://stackoverflow.com/q/19546982/78845#comment29003927_19546982">hence my question in the comments</a> (with new emphasis):</p> <blockquote> <p>How many items are in <code>myList</code> <strong><em>when the error is thrown</em></strong>?</p> </blockquote> <p>Perhaps the simplest fix will be to replace...</p> <pre><code> //Check if there is any item to add to queue while(myList.front().arrival &lt; curr_time) { wt_list.push_back(myList.front()); myList.pop_front(); //Error is coming from this line } while(wt_list.size()&gt;0) { } </code></pre> <p>...with...</p> <pre><code> while (!mylist.empty() &amp;&amp; myList.front().arrival &lt; curr_time) { wt_list.push_back(myList.front()); myList.pop_front(); } while (!wt_list.empty()) { } </code></pre> <p>...but it's hard to tell from the snippet you've provided.</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