<?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[unordered_map und std::string]]></title><description><![CDATA[<p>Hi,</p>
<p>ich habe folgendes Problem:</p>
<pre><code class="language-cpp">#include &quot;unordered_map&quot;
class SymbolInterpreter
{
std::unordered_map&lt;std::string, Symbol&gt; m_hash;
};
</code></pre>
<p>liefert bei mir einen Compiler-Error.<br />
Und zwar:</p>
<pre><code>C:\Meine-Programme\Visual C++\VC\include\xfunctional(92): error C2678: Binärer Operator '==': Es konnte kein Operator gefunden werden, der einen linksseitigen Operanden vom Typ 'const std::string' akzeptiert (oder keine geeignete Konvertierung möglich)
1&gt;          C:\Meine-Programme\Visual C++\VC\include\exception(470): kann 'bool std::operator ==(const std::_Exception_ptr &amp;,const std::_Exception_ptr &amp;)' sein
1&gt;          C:\Meine-Programme\Visual C++\VC\include\exception(475): oder &quot;bool std::operator ==(std::_Null_type,const std::_Exception_ptr &amp;)&quot;
1&gt;          C:\Meine-Programme\Visual C++\VC\include\exception(481): oder &quot;bool std::operator ==(const std::_Exception_ptr &amp;,std::_Null_type)&quot;
1&gt;          C:\Meine-Programme\Visual C++\VC\include\system_error(408): oder &quot;bool std::operator ==(const std::error_code &amp;,const std::error_condition &amp;)&quot;
1&gt;          C:\Meine-Programme\Visual C++\VC\include\system_error(416): oder &quot;bool std::operator ==(const std::error_condition &amp;,const std::error_code &amp;)&quot;
1&gt;          bei Anpassung der Argumentliste '(const std::string, const std::string)'
1&gt;          C:\Meine-Programme\Visual C++\VC\include\xfunctional(91): Bei der Kompilierung der  Klassen-template der bool std::equal_to&lt;_Ty&gt;::operator ()(const _Ty &amp;,const _Ty &amp;) const-Memberfunktion
1&gt;          with
1&gt;          [
1&gt;              _Ty=std::string
1&gt;          ]
1&gt;          C:\Meine-Programme\Visual C++\VC\include\xhash(163): Siehe Verweis auf die Instanziierung der gerade kompilierten Klassen-template &quot;std::equal_to&lt;_Ty&gt;&quot;.
1&gt;          with
1&gt;          [
1&gt;              _Ty=std::string
1&gt;          ]
1&gt;          C:\Meine-Programme\Visual C++\VC\include\unordered_map(73): Siehe Verweis auf die Instanziierung der gerade kompilierten Klassen-template &quot;std::_Hash_compare&lt;_Kty,_Hasher,_Keyeq&gt;&quot;.
1&gt;          with
1&gt;          [
1&gt;              _Kty=std::string,
1&gt;              _Hasher=std::hash&lt;std::string&gt;,
1&gt;              _Keyeq=std::equal_to&lt;std::string&gt;
1&gt;          ]
1&gt;          C:\Meine-Programme\Visual C++\VC\include\xhash(170): Siehe Verweis auf die Instanziierung der gerade kompilierten Klassen-template &quot;std::tr1::_Umap_traits&lt;_Kty,_Ty,_Tr,_Alloc,_Mfl&gt;&quot;.
1&gt;          with
1&gt;          [
1&gt;              _Kty=std::string,
1&gt;              _Ty=Symbol,
1&gt;              _Tr=std::_Hash_compare&lt;std::string,std::hash&lt;std::string&gt;,std::equal_to&lt;std::string&gt;&gt;,
1&gt;              _Alloc=std::allocator&lt;std::pair&lt;const std::string,Symbol&gt;&gt;,
1&gt;              _Mfl=false
1&gt;          ]
1&gt;          C:\Meine-Programme\Visual C++\VC\include\unordered_map(85): Siehe Verweis auf die Instanziierung der gerade kompilierten Klassen-template &quot;std::_Hash&lt;_Traits&gt;&quot;.
1&gt;          with
1&gt;          [
1&gt;              _Traits=std::tr1::_Umap_traits&lt;std::string,Symbol,std::_Hash_compare&lt;std::string,std::hash&lt;std::string&gt;,std::equal_to&lt;std::string&gt;&gt;,std::allocator&lt;std::pair&lt;const std::string,Symbol&gt;&gt;,false&gt;
1&gt;          ]
1&gt;          c:\meine-programme\projektdateien\projekte_vc\Parser\Symbol.h(53): Siehe Verweis auf die Instanziierung der gerade kompilierten Klassen-template &quot;std::tr1::unordered_map&lt;_Kty,_Ty&gt;&quot;.
1&gt;          with
1&gt;          [
1&gt;              _Kty=std::string,
1&gt;              _Ty=Symbol
1&gt;          ]
</code></pre>
<p>Es sieht für mich so aus, als ob halt der '==' Operator für std::string zu viele<br />
Möglichkeiten bereitstellt.</p>
<p>Wie umgehe ich das am besten?</p>
<p>Mfg.</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/295167/unordered_map-und-std-string</link><generator>RSS for Node</generator><lastBuildDate>Sat, 15 Aug 2026 14:26:28 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/295167.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 08 Nov 2011 14:23:51 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to unordered_map und std::string on Tue, 08 Nov 2011 14:23:51 GMT]]></title><description><![CDATA[<p>Hi,</p>
<p>ich habe folgendes Problem:</p>
<pre><code class="language-cpp">#include &quot;unordered_map&quot;
class SymbolInterpreter
{
std::unordered_map&lt;std::string, Symbol&gt; m_hash;
};
</code></pre>
<p>liefert bei mir einen Compiler-Error.<br />
Und zwar:</p>
<pre><code>C:\Meine-Programme\Visual C++\VC\include\xfunctional(92): error C2678: Binärer Operator '==': Es konnte kein Operator gefunden werden, der einen linksseitigen Operanden vom Typ 'const std::string' akzeptiert (oder keine geeignete Konvertierung möglich)
1&gt;          C:\Meine-Programme\Visual C++\VC\include\exception(470): kann 'bool std::operator ==(const std::_Exception_ptr &amp;,const std::_Exception_ptr &amp;)' sein
1&gt;          C:\Meine-Programme\Visual C++\VC\include\exception(475): oder &quot;bool std::operator ==(std::_Null_type,const std::_Exception_ptr &amp;)&quot;
1&gt;          C:\Meine-Programme\Visual C++\VC\include\exception(481): oder &quot;bool std::operator ==(const std::_Exception_ptr &amp;,std::_Null_type)&quot;
1&gt;          C:\Meine-Programme\Visual C++\VC\include\system_error(408): oder &quot;bool std::operator ==(const std::error_code &amp;,const std::error_condition &amp;)&quot;
1&gt;          C:\Meine-Programme\Visual C++\VC\include\system_error(416): oder &quot;bool std::operator ==(const std::error_condition &amp;,const std::error_code &amp;)&quot;
1&gt;          bei Anpassung der Argumentliste '(const std::string, const std::string)'
1&gt;          C:\Meine-Programme\Visual C++\VC\include\xfunctional(91): Bei der Kompilierung der  Klassen-template der bool std::equal_to&lt;_Ty&gt;::operator ()(const _Ty &amp;,const _Ty &amp;) const-Memberfunktion
1&gt;          with
1&gt;          [
1&gt;              _Ty=std::string
1&gt;          ]
1&gt;          C:\Meine-Programme\Visual C++\VC\include\xhash(163): Siehe Verweis auf die Instanziierung der gerade kompilierten Klassen-template &quot;std::equal_to&lt;_Ty&gt;&quot;.
1&gt;          with
1&gt;          [
1&gt;              _Ty=std::string
1&gt;          ]
1&gt;          C:\Meine-Programme\Visual C++\VC\include\unordered_map(73): Siehe Verweis auf die Instanziierung der gerade kompilierten Klassen-template &quot;std::_Hash_compare&lt;_Kty,_Hasher,_Keyeq&gt;&quot;.
1&gt;          with
1&gt;          [
1&gt;              _Kty=std::string,
1&gt;              _Hasher=std::hash&lt;std::string&gt;,
1&gt;              _Keyeq=std::equal_to&lt;std::string&gt;
1&gt;          ]
1&gt;          C:\Meine-Programme\Visual C++\VC\include\xhash(170): Siehe Verweis auf die Instanziierung der gerade kompilierten Klassen-template &quot;std::tr1::_Umap_traits&lt;_Kty,_Ty,_Tr,_Alloc,_Mfl&gt;&quot;.
1&gt;          with
1&gt;          [
1&gt;              _Kty=std::string,
1&gt;              _Ty=Symbol,
1&gt;              _Tr=std::_Hash_compare&lt;std::string,std::hash&lt;std::string&gt;,std::equal_to&lt;std::string&gt;&gt;,
1&gt;              _Alloc=std::allocator&lt;std::pair&lt;const std::string,Symbol&gt;&gt;,
1&gt;              _Mfl=false
1&gt;          ]
1&gt;          C:\Meine-Programme\Visual C++\VC\include\unordered_map(85): Siehe Verweis auf die Instanziierung der gerade kompilierten Klassen-template &quot;std::_Hash&lt;_Traits&gt;&quot;.
1&gt;          with
1&gt;          [
1&gt;              _Traits=std::tr1::_Umap_traits&lt;std::string,Symbol,std::_Hash_compare&lt;std::string,std::hash&lt;std::string&gt;,std::equal_to&lt;std::string&gt;&gt;,std::allocator&lt;std::pair&lt;const std::string,Symbol&gt;&gt;,false&gt;
1&gt;          ]
1&gt;          c:\meine-programme\projektdateien\projekte_vc\Parser\Symbol.h(53): Siehe Verweis auf die Instanziierung der gerade kompilierten Klassen-template &quot;std::tr1::unordered_map&lt;_Kty,_Ty&gt;&quot;.
1&gt;          with
1&gt;          [
1&gt;              _Kty=std::string,
1&gt;              _Ty=Symbol
1&gt;          ]
</code></pre>
<p>Es sieht für mich so aus, als ob halt der '==' Operator für std::string zu viele<br />
Möglichkeiten bereitstellt.</p>
<p>Wie umgehe ich das am besten?</p>
<p>Mfg.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2142154</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2142154</guid><dc:creator><![CDATA[Mathews]]></dc:creator><pubDate>Tue, 08 Nov 2011 14:23:51 GMT</pubDate></item><item><title><![CDATA[Reply to unordered_map und std::string on Tue, 08 Nov 2011 14:27:39 GMT]]></title><description><![CDATA[<p>Nein es ist gar keiner definiert, weil Du den &lt;string&gt; Header nicht inkludiert hast.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2142156</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2142156</guid><dc:creator><![CDATA[brotbernd]]></dc:creator><pubDate>Tue, 08 Nov 2011 14:27:39 GMT</pubDate></item><item><title><![CDATA[Reply to unordered_map und std::string on Tue, 08 Nov 2011 14:35:47 GMT]]></title><description><![CDATA[<p>Ouch, ärgerlich.<br />
Wieso er sich allerdings nicht stattdessen über &quot;unknown-type: string&quot; beschwert - kA.</p>
<p>Nuja, danke.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2142162</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2142162</guid><dc:creator><![CDATA[Mathews]]></dc:creator><pubDate>Tue, 08 Nov 2011 14:35:47 GMT</pubDate></item><item><title><![CDATA[Reply to unordered_map und std::string on Tue, 08 Nov 2011 14:39:40 GMT]]></title><description><![CDATA[<p>Weil der Typ std::string über die inkludierten Header bekannt ist.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2142164</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2142164</guid><dc:creator><![CDATA[brotbernd]]></dc:creator><pubDate>Tue, 08 Nov 2011 14:39:40 GMT</pubDate></item><item><title><![CDATA[Reply to unordered_map und std::string on Tue, 08 Nov 2011 14:41:29 GMT]]></title><description><![CDATA[<p>Mathews schrieb:</p>
<blockquote>
<p>Ouch, ärgerlich.<br />
Wieso er sich allerdings nicht stattdessen über &quot;unknown-type: string&quot; beschwert - kA.</p>
<p>Nuja, danke.</p>
</blockquote>
<p>Kann ja gut sein, dass der Typ string bekannt ist. unordered_map.h wird sicherlich irgendwelche Standardheader einbinden. Der Standard verbietet nicht, dass in einem Header nicht auch Klassen und Funktionen aus einem anderen Header bekannt gemacht werden. Hier wurde anscheinend irgendwo string deklariert, aber nicht der Vergleichsoperator dazu.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2142166</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2142166</guid><dc:creator><![CDATA[SeppJ]]></dc:creator><pubDate>Tue, 08 Nov 2011 14:41:29 GMT</pubDate></item></channel></rss>