<?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[Zeiger auf template]]></title><description><![CDATA[<p>hallo,<br />
ich habe folgendes problem:</p>
<p>ich habe einn zeiger auf ein template der STL</p>
<pre><code>vector&lt;VectorType&gt; *mem1;
mem1=new vector&lt;VectorType&gt;;
</code></pre>
<p>und möchte nun auf das i-te element zugreifen:</p>
<pre><code>mem1error=*(mem1)[i];  //geht nicht
</code></pre>
<p>fehlermeldung:</p>
<blockquote>
<p>dirneu.h:458: error: no match for ‘operator*’ in ‘**(mem1 + ((long unsigned int)(((long unsigned int)i) * 24ul)))’</p>
</blockquote>
<p>hat jemand ne ahnung wie die korrekte syntax ist ?</p>
<p>Gruß und Dank</p>
<p>euler</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/266352/zeiger-auf-template</link><generator>RSS for Node</generator><lastBuildDate>Thu, 03 Sep 2026 07:14:10 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/266352.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 07 May 2010 15:09:34 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Zeiger auf template on Fri, 07 May 2010 15:09:34 GMT]]></title><description><![CDATA[<p>hallo,<br />
ich habe folgendes problem:</p>
<p>ich habe einn zeiger auf ein template der STL</p>
<pre><code>vector&lt;VectorType&gt; *mem1;
mem1=new vector&lt;VectorType&gt;;
</code></pre>
<p>und möchte nun auf das i-te element zugreifen:</p>
<pre><code>mem1error=*(mem1)[i];  //geht nicht
</code></pre>
<p>fehlermeldung:</p>
<blockquote>
<p>dirneu.h:458: error: no match for ‘operator*’ in ‘**(mem1 + ((long unsigned int)(((long unsigned int)i) * 24ul)))’</p>
</blockquote>
<p>hat jemand ne ahnung wie die korrekte syntax ist ?</p>
<p>Gruß und Dank</p>
<p>euler</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1893843</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1893843</guid><dc:creator><![CDATA[euler123]]></dc:creator><pubDate>Fri, 07 May 2010 15:09:34 GMT</pubDate></item><item><title><![CDATA[Reply to Zeiger auf template on Fri, 07 May 2010 15:17:50 GMT]]></title><description><![CDATA[<p>Hallo,<br />
Du musst einfach nur die Klammern anders setzen:</p>
<pre><code class="language-cpp">mem1error = (*mem1)[i];
</code></pre>
<p>So funktioniert es dann bei mir.<br />
MfG, Jochen</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1893847</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1893847</guid><dc:creator><![CDATA[Jochen S.]]></dc:creator><pubDate>Fri, 07 May 2010 15:17:50 GMT</pubDate></item><item><title><![CDATA[Reply to Zeiger auf template on Fri, 07 May 2010 16:07:00 GMT]]></title><description><![CDATA[<p>wieso hast du überhaupt einen pointer? (wenn es nur um das tauschen geht: diese container haben alle eine spezielle überladung für das swap und somit sind tauschoperationen auch so schon extrem schnell und du musst dich nicht um memory-leaks kümmern.<br />
übersichtlicher als <code>(*mem1)[0]</code> find ich btw <code>mem1-&gt;operator[](0)</code> oder noch besser: <code>std::vector&lt;x&gt;&amp; memory1 = *mem1;</code> ... <code>memory1[0]</code> aber das ist wohl geschmackssache...</p>
<p>bb</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1893889</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1893889</guid><dc:creator><![CDATA[unskilled]]></dc:creator><pubDate>Fri, 07 May 2010 16:07:00 GMT</pubDate></item><item><title><![CDATA[Reply to Zeiger auf template on Fri, 07 May 2010 16:13:13 GMT]]></title><description><![CDATA[<p>alternativ:</p>
<pre><code class="language-cpp">zaiger_auf_vector-&gt;at(i)
</code></pre>
<p>Sehe ich aber auch so wie unskilled. Überleg mal, ob nicht auch ein Vektor im automatischen Speicher ausreicht. Eventuell musst Du das Ding nicht per new anlegen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1893896</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1893896</guid><dc:creator><![CDATA[krümelkacker]]></dc:creator><pubDate>Fri, 07 May 2010 16:13:13 GMT</pubDate></item><item><title><![CDATA[Reply to Zeiger auf template on Fri, 07 May 2010 16:54:06 GMT]]></title><description><![CDATA[<p>krümelkacker schrieb:</p>
<blockquote>
<p>alternativ:</p>
<pre><code class="language-cpp">zaiger_auf_vector-&gt;at(i)
</code></pre>
<p>Sehe ich aber auch so wie unskilled. Überleg mal, ob nicht auch ein Vektor im automatischen Speicher ausreicht. Eventuell musst Du das Ding nicht per new anlegen.</p>
</blockquote>
<p>naja - at benutze ich ungern - bei jedem fkt-aufruf wieder ein (unnötiger) range-test... das ist zwar vermutlich nicht mal messbar, aber da gehts mir ums prinzip ^^</p>
<p>bb</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1893917</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1893917</guid><dc:creator><![CDATA[unskilled]]></dc:creator><pubDate>Fri, 07 May 2010 16:54:06 GMT</pubDate></item><item><title><![CDATA[Reply to Zeiger auf template on Sat, 08 May 2010 19:25:12 GMT]]></title><description><![CDATA[<p>danke erstmal für die antworten werde es am montag gleich mal ausprobieren.<br />
motivation für pointer waren hier das ich diese dann per delete wieder löschen kann und so den speicher wieder freigeben kann.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1894383</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1894383</guid><dc:creator><![CDATA[euler123]]></dc:creator><pubDate>Sat, 08 May 2010 19:25:12 GMT</pubDate></item><item><title><![CDATA[Reply to Zeiger auf template on Sat, 08 May 2010 19:51:01 GMT]]></title><description><![CDATA[<p>unskilled schrieb:</p>
<blockquote>
<p>krümelkacker schrieb:</p>
<blockquote>
<p>alternativ:</p>
<pre><code class="language-cpp">zaiger_auf_vector-&gt;at(i)
</code></pre>
<p>Sehe ich aber auch so wie unskilled. Überleg mal, ob nicht auch ein Vektor im automatischen Speicher ausreicht. Eventuell musst Du das Ding nicht per new anlegen.</p>
</blockquote>
<p>naja - at benutze ich ungern</p>
</blockquote>
<p>dann halt</p>
<pre><code class="language-cpp">zeiger_auf_vector-&gt;operator [](i)
</code></pre>
<p><img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f603.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--grinning_face_with_big_eyes"
      title=":D"
      alt="😃"
    /></p>
<p><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/1894395</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1894395</guid><dc:creator><![CDATA[hustbaer]]></dc:creator><pubDate>Sat, 08 May 2010 19:51:01 GMT</pubDate></item><item><title><![CDATA[Reply to Zeiger auf template on Sun, 09 May 2010 05:29:06 GMT]]></title><description><![CDATA[<p>hustbaer schrieb:</p>
<blockquote>
<pre><code class="language-cpp">zeiger_auf_vector-&gt;operator [](i)
</code></pre>
<p><img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f603.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--grinning_face_with_big_eyes"
      title=":D"
      alt="😃"
    /></p>
</blockquote>
<p>Hab gerade keinen Compiler hier...<br />
Funktioniert das wirklich?<br />
Deine Smilies verwirren mich ^^</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1894501</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1894501</guid><dc:creator><![CDATA[Newbie19]]></dc:creator><pubDate>Sun, 09 May 2010 05:29:06 GMT</pubDate></item><item><title><![CDATA[Reply to Zeiger auf template on Sun, 09 May 2010 06:09:28 GMT]]></title><description><![CDATA[<p>ja</p>
<p>operator [] ist eine funktion</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1894508</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1894508</guid><dc:creator><![CDATA[asdas]]></dc:creator><pubDate>Sun, 09 May 2010 06:09:28 GMT</pubDate></item><item><title><![CDATA[Reply to Zeiger auf template on Sun, 09 May 2010 11:49:53 GMT]]></title><description><![CDATA[<p>Funktionieren tut es, ja.<br />
Smileys weil der Vorschlag nicht ganz ernst gemeint war. Ist ja nicht wirklich &quot;schöner&quot; als die bereits vorgeschlagene Variante <code>(*ptr)[i]</code></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1894613</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1894613</guid><dc:creator><![CDATA[hustbaer]]></dc:creator><pubDate>Sun, 09 May 2010 11:49:53 GMT</pubDate></item></channel></rss>