<?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[iteratoren in funktionstemplates]]></title><description><![CDATA[<p>hi. wollte mit grad folgendes template schreiben (vereinfacht) :</p>
<p>template&lt;typename T&gt;<br />
void fun(const std::vector&lt;T&gt;&amp; v, T b)<br />
{<br />
typename std::vector&lt;T&gt;::const_iterator iter_t; //Typanmeldung funktioniert<br />
iter_t i = v.begin(); // Instanziierung dieses Typs funktioniert nicht<br />
...<br />
}</p>
<p>Woran liegt das?</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/119645/iteratoren-in-funktionstemplates</link><generator>RSS for Node</generator><lastBuildDate>Sat, 22 Aug 2026 03:22:36 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/119645.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 03 Sep 2005 18:33:49 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to iteratoren in funktionstemplates on Sat, 03 Sep 2005 18:33:49 GMT]]></title><description><![CDATA[<p>hi. wollte mit grad folgendes template schreiben (vereinfacht) :</p>
<p>template&lt;typename T&gt;<br />
void fun(const std::vector&lt;T&gt;&amp; v, T b)<br />
{<br />
typename std::vector&lt;T&gt;::const_iterator iter_t; //Typanmeldung funktioniert<br />
iter_t i = v.begin(); // Instanziierung dieses Typs funktioniert nicht<br />
...<br />
}</p>
<p>Woran liegt das?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/864347</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/864347</guid><dc:creator><![CDATA[scholli82]]></dc:creator><pubDate>Sat, 03 Sep 2005 18:33:49 GMT</pubDate></item><item><title><![CDATA[Reply to iteratoren in funktionstemplates on Sat, 03 Sep 2005 18:40:49 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">void fun(const std::vector&lt;T&gt;&amp; v, T b) 
    { 
    typename std::vector&lt;T&gt;::const_iterator iter_t;
    iter_t=v.begin();
    ...
    }
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/864348</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/864348</guid><dc:creator><![CDATA[Cpt.Tanga]]></dc:creator><pubDate>Sat, 03 Sep 2005 18:40:49 GMT</pubDate></item><item><title><![CDATA[Reply to iteratoren in funktionstemplates on Sat, 03 Sep 2005 18:43:37 GMT]]></title><description><![CDATA[<p>hab's zeitgleich eben rausgekriegt.<br />
trotzdem dankeschön.</p>
<p>aber wieso wird mit der typendeklaration gleichzeitig der iterator angelegt?<br />
versteh ich irgendwie nicht...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/864349</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/864349</guid><dc:creator><![CDATA[scholli82]]></dc:creator><pubDate>Sat, 03 Sep 2005 18:43:37 GMT</pubDate></item><item><title><![CDATA[Reply to iteratoren in funktionstemplates on Sat, 03 Sep 2005 19:07:55 GMT]]></title><description><![CDATA[<p>Du verwechselst bestimmt typename mit typedef. typename wird nur benutzt wenn man auf Elemente von nem Template-Type zugreifen möchte, was hier der fall ist. Mit typedef erzeiugt man eigene &quot;Pseudeo-&quot;Typen:</p>
<pre><code class="language-cpp">/*
   * Zugriff auf ein Element (const_iterator) vom Template-Type (std::vector &lt; T &gt;)
   */
  typename std::vector&lt;T&gt;::const_iterator iter_t;

  /*
   * Mit typedef einen Pseudo-Type erzeugt.
   */
  typedef typename std::vector&lt;T&gt;::const_iterator iter_t;
  iter_t it; //Ergibt dasselbe wie beim ersten &quot;Fall&quot;.
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/864361</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/864361</guid><dc:creator><![CDATA[Konrad]]></dc:creator><pubDate>Sat, 03 Sep 2005 19:07:55 GMT</pubDate></item><item><title><![CDATA[Reply to iteratoren in funktionstemplates on Sat, 03 Sep 2005 19:17:07 GMT]]></title><description><![CDATA[<p>Konrad schrieb:</p>
<blockquote>
<p>Du verwechselst bestimmt typename mit typedef. typename wird nur benutzt wenn man auf Elemente von nem Template-Type zugreifen möchte, was hier der fall ist. Mit typedef erzeiugt man eigene &quot;Pseudeo-&quot;Typen:</p>
<pre><code class="language-cpp">/*
   * Zugriff auf ein Element (const_iterator) vom Template-Type (std::vector &lt; T &gt;)
   */
  typename std::vector&lt;T&gt;::const_iterator iter_t;

  /*
   * Mit typedef einen Pseudo-Type erzeugt.
   */
  typedef typename std::vector&lt;T&gt;::const_iterator iter_t;
  iter_t it; //Ergibt dasselbe wie beim ersten &quot;Fall&quot;.
</code></pre>
</blockquote>
<p>afaik wird der 2 fall aber nichts.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/864363</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/864363</guid><dc:creator><![CDATA[Cpt.Tanga]]></dc:creator><pubDate>Sat, 03 Sep 2005 19:17:07 GMT</pubDate></item><item><title><![CDATA[Reply to iteratoren in funktionstemplates on Sat, 03 Sep 2005 20:19:43 GMT]]></title><description><![CDATA[<p>Cpt.Tanga schrieb:</p>
<blockquote>
<p>Konrad schrieb:</p>
<blockquote>
<p>Du verwechselst bestimmt typename mit typedef. typename wird nur benutzt wenn man auf Elemente von nem Template-Type zugreifen möchte, was hier der fall ist. Mit typedef erzeiugt man eigene &quot;Pseudeo-&quot;Typen:</p>
<pre><code class="language-cpp">/*
   * Zugriff auf ein Element (const_iterator) vom Template-Type (std::vector &lt; T &gt;)
   */
  typename std::vector&lt;T&gt;::const_iterator iter_t;

  /*
   * Mit typedef einen Pseudo-Type erzeugt.
   */
  typedef typename std::vector&lt;T&gt;::const_iterator iter_t;
  iter_t it; //Ergibt dasselbe wie beim ersten &quot;Fall&quot;.
</code></pre>
</blockquote>
<p>afaik wird der 2 fall aber nichts.</p>
</blockquote>
<p>Warum sollte denn das typedef nicht möglich sein ?<br />
Also afaik ist es doch nen normales /legales typedef.?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/864381</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/864381</guid><dc:creator><![CDATA[shapeless]]></dc:creator><pubDate>Sat, 03 Sep 2005 20:19:43 GMT</pubDate></item><item><title><![CDATA[Reply to iteratoren in funktionstemplates on Sat, 03 Sep 2005 20:37:03 GMT]]></title><description><![CDATA[<p>shapeless schrieb:</p>
<blockquote>
<p>Cpt.Tanga schrieb:</p>
<blockquote>
<p>Konrad schrieb:</p>
<blockquote>
<p>Du verwechselst bestimmt typename mit typedef. typename wird nur benutzt wenn man auf Elemente von nem Template-Type zugreifen möchte, was hier der fall ist. Mit typedef erzeiugt man eigene &quot;Pseudeo-&quot;Typen:</p>
<pre><code class="language-cpp">/*
   * Zugriff auf ein Element (const_iterator) vom Template-Type (std::vector &lt; T &gt;)
   */
  typename std::vector&lt;T&gt;::const_iterator iter_t;

  /*
   * Mit typedef einen Pseudo-Type erzeugt.
   */
  typedef typename std::vector&lt;T&gt;::const_iterator iter_t;
  iter_t it; //Ergibt dasselbe wie beim ersten &quot;Fall&quot;.
</code></pre>
</blockquote>
<p>afaik wird der 2 fall aber nichts.</p>
</blockquote>
<p>Warum sollte denn das typedef nicht möglich sein ?<br />
Also afaik ist es doch nen normales /legales typedef.?</p>
</blockquote>
<p>irrtum meinerseits wuerde ich sagen. hatte noch in tiefer erinnerung was davon haengen wie typedef typename T::bla.... waere (noch) nicht legaler code. ka woher ich das hatte. aber wie ja auch an deiner signatur zu sehen ist scheine ich mich ja zu irren <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f642.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--slightly_smiling_face"
      title=":)"
      alt="🙂"
    /> :p</p>
]]></description><link>https://www.c-plusplus.net/forum/post/864388</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/864388</guid><dc:creator><![CDATA[Cpt.Tanga]]></dc:creator><pubDate>Sat, 03 Sep 2005 20:37:03 GMT</pubDate></item></channel></rss>