<?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[Map und kleiner Operator]]></title><description><![CDATA[<p>Hallo,</p>
<p>ich habe einen Map Container</p>
<pre><code class="language-cpp">std::map&lt;Location, Node&gt; nodes;
</code></pre>
<p>Location und Node sind jeweils eine Klasse.</p>
<p>Allerdings erhalte ich Kompilerfehler</p>
<pre><code>Graph.cpp
c:\programme\microsoft visual studio 8\vc\include\functional(143) : error C2678: Binärer Operator '&lt;': Es konnte kein Operator gefunden werden, der einen linksseitigen Operanden vom Typ 'const Location' akzeptiert (oder keine geeignete Konvertierung möglich)
        c:\dokumente und einstellungen\florian\eigene dateien\visual studio 2005\projects\futurecar_1\location.h(13): kann 'bool Location::operator &lt;(const Location &amp;)' sein
        bei Anpassung der Argumentliste '(const Location, const Location)'
        c:\programme\microsoft visual studio 8\vc\include\functional(142): Bei der Kompilierung der  Klassen-template der bool std::less&lt;_Ty&gt;::operator ()(const _Ty &amp;,const _Ty &amp;) const-Memberfunktion
        with
        [
            _Ty=Location
        ]
        c:\programme\microsoft visual studio 8\vc\include\map(72): Siehe Verweis auf die Instanziierung der gerade kompilierten Klassen-template &quot;std::less&lt;_Ty&gt;&quot;.
        with
        [
            _Ty=Location
        ]
        c:\programme\microsoft visual studio 8\vc\include\xtree(26): Siehe Verweis auf die Instanziierung der gerade kompilierten Klassen-template &quot;std::_Tmap_traits&lt;_Kty,_Ty,_Pr,_Alloc,_Mfl&gt;&quot;.
        with
        [
            _Kty=Location,
            _Ty=Node,
            _Pr=std::less&lt;Location&gt;,
            _Alloc=std::allocator&lt;std::pair&lt;const Location,Node&gt;&gt;,
            _Mfl=false
        ]
        c:\programme\microsoft visual studio 8\vc\include\xtree(68): Siehe Verweis auf die Instanziierung der gerade kompilierten Klassen-template &quot;std::_Tree_nod&lt;_Traits&gt;&quot;.
        with
        [
            _Traits=std::_Tmap_traits&lt;Location,Node,std::less&lt;Location&gt;,std::allocator&lt;std::pair&lt;const Location,Node&gt;&gt;,false&gt;
        ]
        c:\programme\microsoft visual studio 8\vc\include\xtree(94): Siehe Verweis auf die Instanziierung der gerade kompilierten Klassen-template &quot;std::_Tree_ptr&lt;_Traits&gt;&quot;.
        with
        [
            _Traits=std::_Tmap_traits&lt;Location,Node,std::less&lt;Location&gt;,std::allocator&lt;std::pair&lt;const Location,Node&gt;&gt;,false&gt;
        ]
        c:\programme\microsoft visual studio 8\vc\include\xtree(112): Siehe Verweis auf die Instanziierung der gerade kompilierten Klassen-template &quot;std::_Tree_val&lt;_Traits&gt;&quot;.
        with
        [
            _Traits=std::_Tmap_traits&lt;Location,Node,std::less&lt;Location&gt;,std::allocator&lt;std::pair&lt;const Location,Node&gt;&gt;,false&gt;
        ]
        c:\programme\microsoft visual studio 8\vc\include\map(82): Siehe Verweis auf die Instanziierung der gerade kompilierten Klassen-template &quot;std::_Tree&lt;_Traits&gt;&quot;.
        with
        [
            _Traits=std::_Tmap_traits&lt;Location,Node,std::less&lt;Location&gt;,std::allocator&lt;std::pair&lt;const Location,Node&gt;&gt;,false&gt;
        ]
        c:\dokumente und einstellungen\florian\eigene dateien\visual studio 2005\projects\futurecar_1\graph.h(10): Siehe Verweis auf die Instanziierung der gerade kompilierten Klassen-template &quot;std::map&lt;_Kty,_Ty&gt;&quot;.
        with
        [
            _Kty=Location,
            _Ty=Node
        ]
</code></pre>
<p>Ich gehe davon aus, dass es irgendwas damit zu tun hat, dass die operator&lt; Überladung in meiner Location Klasse nicht so wirklich funktioniert für den Sortieralgorithmus std::less</p>
<pre><code class="language-cpp">bool Location::operator&lt;(const Location&amp; loc) 
{ 
  return (this-&gt;xAxis &lt; loc.xAxis &amp;&amp; this-&gt;yAxis &lt; loc.yAxis) ;  
}
</code></pre>
<p>Was ist da genau los?</p>
<p>LG</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/231731/map-und-kleiner-operator</link><generator>RSS for Node</generator><lastBuildDate>Fri, 25 Sep 2026 17:42:56 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/231731.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 14 Jan 2009 14:28:04 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Map und kleiner Operator on Wed, 14 Jan 2009 14:28:04 GMT]]></title><description><![CDATA[<p>Hallo,</p>
<p>ich habe einen Map Container</p>
<pre><code class="language-cpp">std::map&lt;Location, Node&gt; nodes;
</code></pre>
<p>Location und Node sind jeweils eine Klasse.</p>
<p>Allerdings erhalte ich Kompilerfehler</p>
<pre><code>Graph.cpp
c:\programme\microsoft visual studio 8\vc\include\functional(143) : error C2678: Binärer Operator '&lt;': Es konnte kein Operator gefunden werden, der einen linksseitigen Operanden vom Typ 'const Location' akzeptiert (oder keine geeignete Konvertierung möglich)
        c:\dokumente und einstellungen\florian\eigene dateien\visual studio 2005\projects\futurecar_1\location.h(13): kann 'bool Location::operator &lt;(const Location &amp;)' sein
        bei Anpassung der Argumentliste '(const Location, const Location)'
        c:\programme\microsoft visual studio 8\vc\include\functional(142): Bei der Kompilierung der  Klassen-template der bool std::less&lt;_Ty&gt;::operator ()(const _Ty &amp;,const _Ty &amp;) const-Memberfunktion
        with
        [
            _Ty=Location
        ]
        c:\programme\microsoft visual studio 8\vc\include\map(72): Siehe Verweis auf die Instanziierung der gerade kompilierten Klassen-template &quot;std::less&lt;_Ty&gt;&quot;.
        with
        [
            _Ty=Location
        ]
        c:\programme\microsoft visual studio 8\vc\include\xtree(26): Siehe Verweis auf die Instanziierung der gerade kompilierten Klassen-template &quot;std::_Tmap_traits&lt;_Kty,_Ty,_Pr,_Alloc,_Mfl&gt;&quot;.
        with
        [
            _Kty=Location,
            _Ty=Node,
            _Pr=std::less&lt;Location&gt;,
            _Alloc=std::allocator&lt;std::pair&lt;const Location,Node&gt;&gt;,
            _Mfl=false
        ]
        c:\programme\microsoft visual studio 8\vc\include\xtree(68): Siehe Verweis auf die Instanziierung der gerade kompilierten Klassen-template &quot;std::_Tree_nod&lt;_Traits&gt;&quot;.
        with
        [
            _Traits=std::_Tmap_traits&lt;Location,Node,std::less&lt;Location&gt;,std::allocator&lt;std::pair&lt;const Location,Node&gt;&gt;,false&gt;
        ]
        c:\programme\microsoft visual studio 8\vc\include\xtree(94): Siehe Verweis auf die Instanziierung der gerade kompilierten Klassen-template &quot;std::_Tree_ptr&lt;_Traits&gt;&quot;.
        with
        [
            _Traits=std::_Tmap_traits&lt;Location,Node,std::less&lt;Location&gt;,std::allocator&lt;std::pair&lt;const Location,Node&gt;&gt;,false&gt;
        ]
        c:\programme\microsoft visual studio 8\vc\include\xtree(112): Siehe Verweis auf die Instanziierung der gerade kompilierten Klassen-template &quot;std::_Tree_val&lt;_Traits&gt;&quot;.
        with
        [
            _Traits=std::_Tmap_traits&lt;Location,Node,std::less&lt;Location&gt;,std::allocator&lt;std::pair&lt;const Location,Node&gt;&gt;,false&gt;
        ]
        c:\programme\microsoft visual studio 8\vc\include\map(82): Siehe Verweis auf die Instanziierung der gerade kompilierten Klassen-template &quot;std::_Tree&lt;_Traits&gt;&quot;.
        with
        [
            _Traits=std::_Tmap_traits&lt;Location,Node,std::less&lt;Location&gt;,std::allocator&lt;std::pair&lt;const Location,Node&gt;&gt;,false&gt;
        ]
        c:\dokumente und einstellungen\florian\eigene dateien\visual studio 2005\projects\futurecar_1\graph.h(10): Siehe Verweis auf die Instanziierung der gerade kompilierten Klassen-template &quot;std::map&lt;_Kty,_Ty&gt;&quot;.
        with
        [
            _Kty=Location,
            _Ty=Node
        ]
</code></pre>
<p>Ich gehe davon aus, dass es irgendwas damit zu tun hat, dass die operator&lt; Überladung in meiner Location Klasse nicht so wirklich funktioniert für den Sortieralgorithmus std::less</p>
<pre><code class="language-cpp">bool Location::operator&lt;(const Location&amp; loc) 
{ 
  return (this-&gt;xAxis &lt; loc.xAxis &amp;&amp; this-&gt;yAxis &lt; loc.yAxis) ;  
}
</code></pre>
<p>Was ist da genau los?</p>
<p>LG</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1645395</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1645395</guid><dc:creator><![CDATA[skiz]]></dc:creator><pubDate>Wed, 14 Jan 2009 14:28:04 GMT</pubDate></item><item><title><![CDATA[Reply to Map und kleiner Operator on Wed, 14 Jan 2009 14:29:59 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">bool Location::operator&lt;(const Location&amp; loc) const
{
  return (this-&gt;xAxis &lt; loc.xAxis &amp;&amp; this-&gt;yAxis &lt; loc.yAxis) ;  
}
</code></pre>
<p>const-corectness</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1645397</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1645397</guid><dc:creator><![CDATA[drakon]]></dc:creator><pubDate>Wed, 14 Jan 2009 14:29:59 GMT</pubDate></item><item><title><![CDATA[Reply to Map und kleiner Operator on Wed, 14 Jan 2009 14:31:34 GMT]]></title><description><![CDATA[<p>ohman ohman danke <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>
]]></description><link>https://www.c-plusplus.net/forum/post/1645402</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1645402</guid><dc:creator><![CDATA[skiz]]></dc:creator><pubDate>Wed, 14 Jan 2009 14:31:34 GMT</pubDate></item></channel></rss>