<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Queue und pop()]]></title><description><![CDATA[<p>Hallo!</p>
<p>Wie bekomme ich meinen Pointer zurück? <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f61e.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--disappointed_face"
      title=":("
      alt="😞"
    /></p>
<p>queue &lt;char *, deque&lt;char *&gt; &gt; m_pqNettoMsgs ;</p>
<p>char *pac = new char[6];</p>
<p>strcpy( pac, &quot;Hallo&quot;);</p>
<p>m_pqNettoMsgs.push( pac);</p>
<p>pac = m_pqNettoMsgs.pop() ; // line 28</p>
<p>delete [] pac;</p>
<p>[C++ Error] Unit1.cpp(28): E2109 Not an allowed type</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/119936/queue-und-pop</link><generator>RSS for Node</generator><lastBuildDate>Sat, 22 Aug 2026 04:27:55 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/119936.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 07 Sep 2005 09:44:16 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Queue und pop() on Wed, 07 Sep 2005 09:44:16 GMT]]></title><description><![CDATA[<p>Hallo!</p>
<p>Wie bekomme ich meinen Pointer zurück? <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f61e.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--disappointed_face"
      title=":("
      alt="😞"
    /></p>
<p>queue &lt;char *, deque&lt;char *&gt; &gt; m_pqNettoMsgs ;</p>
<p>char *pac = new char[6];</p>
<p>strcpy( pac, &quot;Hallo&quot;);</p>
<p>m_pqNettoMsgs.push( pac);</p>
<p>pac = m_pqNettoMsgs.pop() ; // line 28</p>
<p>delete [] pac;</p>
<p>[C++ Error] Unit1.cpp(28): E2109 Not an allowed type</p>
]]></description><link>https://www.c-plusplus.net/forum/post/866843</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/866843</guid><dc:creator><![CDATA[GV]]></dc:creator><pubDate>Wed, 07 Sep 2005 09:44:16 GMT</pubDate></item><item><title><![CDATA[Reply to Queue und pop() on Wed, 07 Sep 2005 09:46:13 GMT]]></title><description><![CDATA[<p>Benutze Borland C++ Builder 5 .</p>
]]></description><link>https://www.c-plusplus.net/forum/post/866845</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/866845</guid><dc:creator><![CDATA[GV]]></dc:creator><pubDate>Wed, 07 Sep 2005 09:46:13 GMT</pubDate></item><item><title><![CDATA[Reply to Queue und pop() on Wed, 07 Sep 2005 09:56:33 GMT]]></title><description><![CDATA[<p>pop() hat keinen Rückgabewert. Benutze back() dafür. back() liefert eine Referenz, die nach pop() aber ungültig wird. D.h. back() aufrufen, Kopie machen, pop() aufrufen.</p>
<pre><code class="language-cpp">queue &lt;char *, deque&lt;char *&gt; &gt; m_pqNettoMsgs ;
char *pac = new char[6];
strcpy( pac, &quot;Hallo&quot;);
m_pqNettoMsgs.push( pac);
pac = m_pqNettoMsgs.back();
m_pqNettoMsgs.pop();
delete [] pac;
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/866846</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/866846</guid><dc:creator><![CDATA[7H3 N4C3R]]></dc:creator><pubDate>Wed, 07 Sep 2005 09:56:33 GMT</pubDate></item><item><title><![CDATA[Reply to Queue und pop() on Wed, 07 Sep 2005 10:03:28 GMT]]></title><description><![CDATA[<p>Danke, funktioniert. Ich nehme allerdings front(), da ich ja einen FIFO implementieren will.</p>
<p>Dann frage ich mich allerdings, warum ich nicht einfach einen vector benutzte. Der Arbeitsaufwand ist ja wohl der gleiche. Ich hatte eigentlich gedacht, dass ich mir durch die Verwendung von queue einen Schritt spare.</p>
<p>Naja, wieder was gelernt. <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f609.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--winking_face"
      title=";)"
      alt="😉"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/866864</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/866864</guid><dc:creator><![CDATA[GV]]></dc:creator><pubDate>Wed, 07 Sep 2005 10:03:28 GMT</pubDate></item><item><title><![CDATA[Reply to Queue und pop() on Wed, 07 Sep 2005 10:20:37 GMT]]></title><description><![CDATA[<p>Öhm jo front() ist wohl das was du willst. Hab ich jetzt nicht drauf geachtet, aber es geht auch ums Prinzip bei dieser Art von Operationen.</p>
<p>Hier ein Auszug aus der SGI STL Doku zu front(). Dieses Design wirst Du übrigens in allen Containerklassen finden:</p>
<blockquote>
<p>[3] One might wonder why pop() returns void, instead of value_type. That is, why must one use front() and pop() to examine and remove the element at the front of the queue, instead of combining the two in a single member function? In fact, there is a good reason for this design. If pop() returned the front element, it would have to return by value rather than by reference: return by reference would create a dangling pointer. Return by value, however, is inefficient: it involves at least one redundant copy constructor call. Since it is impossible for pop() to return a value in such a way as to be both efficient and correct, it is more sensible for it to return no value at all and to require clients to use front() to inspect the value at the front of the queue.</p>
</blockquote>
]]></description><link>https://www.c-plusplus.net/forum/post/866875</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/866875</guid><dc:creator><![CDATA[7H3 N4C3R]]></dc:creator><pubDate>Wed, 07 Sep 2005 10:20:37 GMT</pubDate></item></channel></rss>