<?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[stl problem: could not deduce template argument...]]></title><description><![CDATA[<p>Ok, ich hab da ein kleines Problem. Naja es is t so groß das ich einfach nicht mehr weiter komme...<br />
Um mal vereinfach darzustellen was mein Prob is hab ich mal folgenden bsp. code gebastelt:</p>
<pre><code class="language-cpp">#include &lt;list&gt;

class MyType
{
    MyType(){}
    ~MyType(){}
};

typedef std::list&lt;MyType&gt; tpLst;
typedef tpLst::iterator tpLstIt;

int main()
{
    tpLst list;
    tpLstIt it = list.begin();
    it &lt; list.end(); // hier liegt das Problem
    return 0;
}
</code></pre>
<p>Ich möchte eigentlich nur durch eine Liste von MyType's iterieren. Wenn ich den oben stehenden Code compilieren will bekomm ich allerdings folgende Fehler:</p>
<pre><code>cl.exe /nologo /GX /GR /DUNICODE /Ox /Og /DNDEBUG /GX  /ID:\Progs\arbeiten\vc++\include  /c main.cpp /Foobj\Release\main.obj
main.cpp
main.cpp(16) : error C2784: 'bool std::operator &lt;(const std::list&lt;_Ty,_Alloc&gt; &amp;,const std::list&lt;_Ty,_Alloc&gt; &amp;)' : could not deduce template argument for 'const std::list&lt;_Ty,_Ax&gt; &amp;' from 'tpLstIt'
        D:\Progs\arbeiten\vc++\include\list(991) : see declaration of 'std::operator`&lt;''
main.cpp(16) : error C2784: 'bool std::operator &lt;(const std::list&lt;_Ty,_Alloc&gt; &amp;,const std::list&lt;_Ty,_Alloc&gt; &amp;)' : could not deduce template argument for 'const std::list&lt;_Ty,_Ax&gt; &amp;' from 'tpLstIt'
        D:\Progs\arbeiten\vc++\include\list(991) : see declaration of 'std::operator`&lt;''
main.cpp(16) : error C2784: 'bool std::operator &lt;(const std::list&lt;_Ty,_Alloc&gt; &amp;,const std::list&lt;_Ty,_Alloc&gt; &amp;)' : could not deduce template argument for 'const std::list&lt;_Ty,_Ax&gt; &amp;' from 'tpLstIt'
        D:\Progs\arbeiten\vc++\include\list(991) : see declaration of 'std::operator`&lt;''
main.cpp(16) : error C2784: 'bool std::operator &lt;(const std::list&lt;_Ty,_Alloc&gt; &amp;,const std::list&lt;_Ty,_Alloc&gt; &amp;)' : could not deduce template argument for 'const std::list&lt;_Ty,_Ax&gt; &amp;' from 'tpLstIt'
        D:\Progs\arbeiten\vc++\include\list(991) : see declaration of 'std::operator`&lt;''
main.cpp(16) : error C2784: 'bool std::operator &lt;(const std::reverse_iterator&lt;_RanIt&gt; &amp;,const std::reverse_iterator&lt;_RanIt&gt; &amp;)' : could not deduce template argument for 'const std::reverse_iterator&lt;_RanIt&gt; &amp;' from 'tpLstIt'
        D:\Progs\arbeiten\vc++\include\xutility(655) : see declaration of 'std::operator`&lt;''
main.cpp(16) : error C2784: 'bool std::operator &lt;(const std::reverse_iterator&lt;_RanIt&gt; &amp;,const std::reverse_iterator&lt;_RanIt&gt; &amp;)' : could not deduce template argument for 'const std::reverse_iterator&lt;_RanIt&gt; &amp;' from 'tpLstIt'
        D:\Progs\arbeiten\vc++\include\xutility(655) : see declaration of 'std::operator`&lt;''
main.cpp(16) : error C2784: 'bool std::operator &lt;(const std::reverse_iterator&lt;_RanIt&gt; &amp;,const std::reverse_iterator&lt;_RanIt&gt; &amp;)' : could not deduce template argument for 'const std::reverse_iterator&lt;_RanIt&gt; &amp;' from 'tpLstIt'
        D:\Progs\arbeiten\vc++\include\xutility(655) : see declaration of 'std::operator`&lt;''
main.cpp(16) : error C2784: 'bool std::operator &lt;(const std::reverse_iterator&lt;_RanIt&gt; &amp;,const std::reverse_iterator&lt;_RanIt&gt; &amp;)' : could not deduce template argument for 'const std::reverse_iterator&lt;_RanIt&gt; &amp;' from 'tpLstIt'
        D:\Progs\arbeiten\vc++\include\xutility(655) : see declaration of 'std::operator`&lt;''
main.cpp(16) : error C2784: 'bool std::operator &lt;(const std::pair&lt;_Ty1,_Ty2&gt; &amp;,const std::pair&lt;_Ty1,_Ty2&gt; &amp;)' : could not deduce template argument for 'const std::pair&lt;_Ty1,_Ty2&gt; &amp;' from 'tpLstIt'
        D:\Progs\arbeiten\vc++\include\utility(73) : see declaration of 'std::operator`&lt;''
main.cpp(16) : error C2784: 'bool std::operator &lt;(const std::pair&lt;_Ty1,_Ty2&gt; &amp;,const std::pair&lt;_Ty1,_Ty2&gt; &amp;)' : could not deduce template argument for 'const std::pair&lt;_Ty1,_Ty2&gt; &amp;' from 'tpLstIt'
        D:\Progs\arbeiten\vc++\include\utility(73) : see declaration of 'std::operator`&lt;''
main.cpp(16) : error C2784: 'bool std::operator &lt;(const std::pair&lt;_Ty1,_Ty2&gt; &amp;,const std::pair&lt;_Ty1,_Ty2&gt; &amp;)' : could not deduce template argument for 'const std::pair&lt;_Ty1,_Ty2&gt; &amp;' from 'tpLstIt'
        D:\Progs\arbeiten\vc++\include\utility(73) : see declaration of 'std::operator`&lt;''
main.cpp(16) : error C2784: 'bool std::operator &lt;(const std::pair&lt;_Ty1,_Ty2&gt; &amp;,const std::pair&lt;_Ty1,_Ty2&gt; &amp;)' : could not deduce template argument for 'const std::pair&lt;_Ty1,_Ty2&gt; &amp;' from 'tpLstIt'
        D:\Progs\arbeiten\vc++\include\utility(73) : see declaration of 'std::operator`&lt;''
main.cpp(16) : error C2676: binary '&lt;' : 'tpLstIt' does not define this operator or a conversion to a type acceptable to the predefined operator
</code></pre>
<p>Mit einem vector funktioniert es problemlos aber sollten die iteratoren nicht für alle datencontainer gleich funktionieren? Ich bin am verzweifeln!</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/154635/stl-problem-could-not-deduce-template-argument</link><generator>RSS for Node</generator><lastBuildDate>Mon, 07 Sep 2026 23:43:59 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/154635.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 28 Jul 2006 23:18:45 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to stl problem: could not deduce template argument... on Fri, 28 Jul 2006 23:18:45 GMT]]></title><description><![CDATA[<p>Ok, ich hab da ein kleines Problem. Naja es is t so groß das ich einfach nicht mehr weiter komme...<br />
Um mal vereinfach darzustellen was mein Prob is hab ich mal folgenden bsp. code gebastelt:</p>
<pre><code class="language-cpp">#include &lt;list&gt;

class MyType
{
    MyType(){}
    ~MyType(){}
};

typedef std::list&lt;MyType&gt; tpLst;
typedef tpLst::iterator tpLstIt;

int main()
{
    tpLst list;
    tpLstIt it = list.begin();
    it &lt; list.end(); // hier liegt das Problem
    return 0;
}
</code></pre>
<p>Ich möchte eigentlich nur durch eine Liste von MyType's iterieren. Wenn ich den oben stehenden Code compilieren will bekomm ich allerdings folgende Fehler:</p>
<pre><code>cl.exe /nologo /GX /GR /DUNICODE /Ox /Og /DNDEBUG /GX  /ID:\Progs\arbeiten\vc++\include  /c main.cpp /Foobj\Release\main.obj
main.cpp
main.cpp(16) : error C2784: 'bool std::operator &lt;(const std::list&lt;_Ty,_Alloc&gt; &amp;,const std::list&lt;_Ty,_Alloc&gt; &amp;)' : could not deduce template argument for 'const std::list&lt;_Ty,_Ax&gt; &amp;' from 'tpLstIt'
        D:\Progs\arbeiten\vc++\include\list(991) : see declaration of 'std::operator`&lt;''
main.cpp(16) : error C2784: 'bool std::operator &lt;(const std::list&lt;_Ty,_Alloc&gt; &amp;,const std::list&lt;_Ty,_Alloc&gt; &amp;)' : could not deduce template argument for 'const std::list&lt;_Ty,_Ax&gt; &amp;' from 'tpLstIt'
        D:\Progs\arbeiten\vc++\include\list(991) : see declaration of 'std::operator`&lt;''
main.cpp(16) : error C2784: 'bool std::operator &lt;(const std::list&lt;_Ty,_Alloc&gt; &amp;,const std::list&lt;_Ty,_Alloc&gt; &amp;)' : could not deduce template argument for 'const std::list&lt;_Ty,_Ax&gt; &amp;' from 'tpLstIt'
        D:\Progs\arbeiten\vc++\include\list(991) : see declaration of 'std::operator`&lt;''
main.cpp(16) : error C2784: 'bool std::operator &lt;(const std::list&lt;_Ty,_Alloc&gt; &amp;,const std::list&lt;_Ty,_Alloc&gt; &amp;)' : could not deduce template argument for 'const std::list&lt;_Ty,_Ax&gt; &amp;' from 'tpLstIt'
        D:\Progs\arbeiten\vc++\include\list(991) : see declaration of 'std::operator`&lt;''
main.cpp(16) : error C2784: 'bool std::operator &lt;(const std::reverse_iterator&lt;_RanIt&gt; &amp;,const std::reverse_iterator&lt;_RanIt&gt; &amp;)' : could not deduce template argument for 'const std::reverse_iterator&lt;_RanIt&gt; &amp;' from 'tpLstIt'
        D:\Progs\arbeiten\vc++\include\xutility(655) : see declaration of 'std::operator`&lt;''
main.cpp(16) : error C2784: 'bool std::operator &lt;(const std::reverse_iterator&lt;_RanIt&gt; &amp;,const std::reverse_iterator&lt;_RanIt&gt; &amp;)' : could not deduce template argument for 'const std::reverse_iterator&lt;_RanIt&gt; &amp;' from 'tpLstIt'
        D:\Progs\arbeiten\vc++\include\xutility(655) : see declaration of 'std::operator`&lt;''
main.cpp(16) : error C2784: 'bool std::operator &lt;(const std::reverse_iterator&lt;_RanIt&gt; &amp;,const std::reverse_iterator&lt;_RanIt&gt; &amp;)' : could not deduce template argument for 'const std::reverse_iterator&lt;_RanIt&gt; &amp;' from 'tpLstIt'
        D:\Progs\arbeiten\vc++\include\xutility(655) : see declaration of 'std::operator`&lt;''
main.cpp(16) : error C2784: 'bool std::operator &lt;(const std::reverse_iterator&lt;_RanIt&gt; &amp;,const std::reverse_iterator&lt;_RanIt&gt; &amp;)' : could not deduce template argument for 'const std::reverse_iterator&lt;_RanIt&gt; &amp;' from 'tpLstIt'
        D:\Progs\arbeiten\vc++\include\xutility(655) : see declaration of 'std::operator`&lt;''
main.cpp(16) : error C2784: 'bool std::operator &lt;(const std::pair&lt;_Ty1,_Ty2&gt; &amp;,const std::pair&lt;_Ty1,_Ty2&gt; &amp;)' : could not deduce template argument for 'const std::pair&lt;_Ty1,_Ty2&gt; &amp;' from 'tpLstIt'
        D:\Progs\arbeiten\vc++\include\utility(73) : see declaration of 'std::operator`&lt;''
main.cpp(16) : error C2784: 'bool std::operator &lt;(const std::pair&lt;_Ty1,_Ty2&gt; &amp;,const std::pair&lt;_Ty1,_Ty2&gt; &amp;)' : could not deduce template argument for 'const std::pair&lt;_Ty1,_Ty2&gt; &amp;' from 'tpLstIt'
        D:\Progs\arbeiten\vc++\include\utility(73) : see declaration of 'std::operator`&lt;''
main.cpp(16) : error C2784: 'bool std::operator &lt;(const std::pair&lt;_Ty1,_Ty2&gt; &amp;,const std::pair&lt;_Ty1,_Ty2&gt; &amp;)' : could not deduce template argument for 'const std::pair&lt;_Ty1,_Ty2&gt; &amp;' from 'tpLstIt'
        D:\Progs\arbeiten\vc++\include\utility(73) : see declaration of 'std::operator`&lt;''
main.cpp(16) : error C2784: 'bool std::operator &lt;(const std::pair&lt;_Ty1,_Ty2&gt; &amp;,const std::pair&lt;_Ty1,_Ty2&gt; &amp;)' : could not deduce template argument for 'const std::pair&lt;_Ty1,_Ty2&gt; &amp;' from 'tpLstIt'
        D:\Progs\arbeiten\vc++\include\utility(73) : see declaration of 'std::operator`&lt;''
main.cpp(16) : error C2676: binary '&lt;' : 'tpLstIt' does not define this operator or a conversion to a type acceptable to the predefined operator
</code></pre>
<p>Mit einem vector funktioniert es problemlos aber sollten die iteratoren nicht für alle datencontainer gleich funktionieren? Ich bin am verzweifeln!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1106448</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1106448</guid><dc:creator><![CDATA[Matroc]]></dc:creator><pubDate>Fri, 28 Jul 2006 23:18:45 GMT</pubDate></item><item><title><![CDATA[Reply to stl problem: could not deduce template argument... on Fri, 28 Jul 2006 23:45:48 GMT]]></title><description><![CDATA[<p>Fürs iterieren brauchst du nur den != operator.</p>
<p>mfg.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1106454</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1106454</guid><dc:creator><![CDATA[joomoo]]></dc:creator><pubDate>Fri, 28 Jul 2006 23:45:48 GMT</pubDate></item><item><title><![CDATA[Reply to stl problem: could not deduce template argument... on Sat, 29 Jul 2006 07:41:08 GMT]]></title><description><![CDATA[<p>Um den op&lt; nutzen zu können, benötigst du einen random-access-iterator. Die liste bietet aber nur den bidirectional-iterator an. und der besitzt halt nur op!=. Mit dem kannste aber genausogut iterieren <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/1106489</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1106489</guid><dc:creator><![CDATA[otze]]></dc:creator><pubDate>Sat, 29 Jul 2006 07:41:08 GMT</pubDate></item><item><title><![CDATA[Reply to stl problem: could not deduce template argument... on Sat, 29 Jul 2006 10:03:00 GMT]]></title><description><![CDATA[<p>ah, das macht natürlich sinn, hätt ich auch sellbst drauf kommen können...</p>
<p>naja, vielen dank auf jeden fall!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1106543</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1106543</guid><dc:creator><![CDATA[Matroc]]></dc:creator><pubDate>Sat, 29 Jul 2006 10:03:00 GMT</pubDate></item></channel></rss>