<?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[const_cast bei Pointer]]></title><description><![CDATA[<p>Hallo</p>
<p>Ich habe folgendes Codestück:</p>
<pre><code class="language-cpp">//this-&gt;Pointer ist vom Typ T*
template&lt;class T&gt;
void
LibName:: // :D 
Smartpointer::
AutoPtr&lt;T&gt;::
Reset(const T* Pointer) throw()
{
  if(this-&gt;Pointer)
    delete this-&gt;Pointer;
  this-&gt;Pointer = Pointer;
};
</code></pre>
<p>Die zweit unterste Linie macht Probleme. Ist ein <code>const_cast</code> die letzte Lösung?</p>
<p>MfG, EOutOfResources</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/284252/const_cast-bei-pointer</link><generator>RSS for Node</generator><lastBuildDate>Sat, 22 Aug 2026 05:34:21 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/284252.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 28 Mar 2011 17:47:43 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to const_cast bei Pointer on Mon, 28 Mar 2011 17:47:43 GMT]]></title><description><![CDATA[<p>Hallo</p>
<p>Ich habe folgendes Codestück:</p>
<pre><code class="language-cpp">//this-&gt;Pointer ist vom Typ T*
template&lt;class T&gt;
void
LibName:: // :D 
Smartpointer::
AutoPtr&lt;T&gt;::
Reset(const T* Pointer) throw()
{
  if(this-&gt;Pointer)
    delete this-&gt;Pointer;
  this-&gt;Pointer = Pointer;
};
</code></pre>
<p>Die zweit unterste Linie macht Probleme. Ist ein <code>const_cast</code> die letzte Lösung?</p>
<p>MfG, EOutOfResources</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2041446</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2041446</guid><dc:creator><![CDATA[EOutOfResources]]></dc:creator><pubDate>Mon, 28 Mar 2011 17:47:43 GMT</pubDate></item><item><title><![CDATA[Reply to const_cast bei Pointer on Mon, 28 Mar 2011 17:50:35 GMT]]></title><description><![CDATA[<p>Bei dem Rest, den man sich zusammenreimen muss, würd ich sagen, das &quot;const&quot; ist da falsch.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2041448</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2041448</guid><dc:creator><![CDATA[krümelkacker]]></dc:creator><pubDate>Mon, 28 Mar 2011 17:50:35 GMT</pubDate></item><item><title><![CDATA[Reply to const_cast bei Pointer on Mon, 28 Mar 2011 17:58:17 GMT]]></title><description><![CDATA[<p>Ach ja, es entsteht ja sowieso eine Kopie. Sorry, ich bin irgendwie ein wenig verwirrt...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2041455</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2041455</guid><dc:creator><![CDATA[EOutOfResources]]></dc:creator><pubDate>Mon, 28 Mar 2011 17:58:17 GMT</pubDate></item></channel></rss>