<?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[vector sortieren]]></title><description><![CDATA[<p>Hi,<br />
ich hab folgenden Vector den ich alphabetisch sortieren möchte:</p>
<pre><code class="language-cpp">struct DAT
{
  std::string t1;
  std::string t2;
  std::string t3;
}
std::vector&lt;DAT&gt; m_Daten;
</code></pre>
<p>Diesen Vector möchte ich nach t1 sortieren, ich habe aber keine Ahnung wie ich das machen muss. Könnt ihr mir da weiterhelfen?</p>
<p>Gruß<br />
Peter</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/122747/vector-sortieren</link><generator>RSS for Node</generator><lastBuildDate>Sun, 23 Aug 2026 07:17:15 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/122747.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 09 Oct 2005 14:27:44 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to vector sortieren on Sun, 09 Oct 2005 14:27:44 GMT]]></title><description><![CDATA[<p>Hi,<br />
ich hab folgenden Vector den ich alphabetisch sortieren möchte:</p>
<pre><code class="language-cpp">struct DAT
{
  std::string t1;
  std::string t2;
  std::string t3;
}
std::vector&lt;DAT&gt; m_Daten;
</code></pre>
<p>Diesen Vector möchte ich nach t1 sortieren, ich habe aber keine Ahnung wie ich das machen muss. Könnt ihr mir da weiterhelfen?</p>
<p>Gruß<br />
Peter</p>
]]></description><link>https://www.c-plusplus.net/forum/post/888217</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/888217</guid><dc:creator><![CDATA[Frage3432]]></dc:creator><pubDate>Sun, 09 Oct 2005 14:27:44 GMT</pubDate></item><item><title><![CDATA[Reply to vector sortieren on Sun, 09 Oct 2005 14:36:23 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">struct Sort_DAT_t1
{
	bool operator() (DAT const&amp; d1, DAT const&amp; d2) {return d1.t1 &lt; d2.t1;}
};

std::sort(m_Daten.begin(), m_Daten.end(), Sort_DAT_t1());
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/888219</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/888219</guid><dc:creator><![CDATA[MFK]]></dc:creator><pubDate>Sun, 09 Oct 2005 14:36:23 GMT</pubDate></item><item><title><![CDATA[Reply to vector sortieren on Sun, 09 Oct 2005 14:56:47 GMT]]></title><description><![CDATA[<p>MFK schrieb:</p>
<blockquote>
<pre><code class="language-cpp">struct Sort_DAT_t1
{
	bool operator() (DAT const&amp; d1, DAT const&amp; d2) {return d1.t1 &lt; d2.t1;}
};

std::sort(m_Daten.begin(), m_Daten.end(), Sort_DAT_t1());
</code></pre>
</blockquote>
<p>Vielen Dank für deine Antwort, leider funktioniert das noch nicht ganz, ich erhalte folgende Fehlermeldung:</p>
<blockquote>
<p>error C2678: Binärer Operator '&lt;': Es konnte kein Operator gefunden werden, der einen linksseitigen Operator vom Typ 'const std::string' akzeptiert (oder keine geeignete Konvertierung möglich)</p>
</blockquote>
]]></description><link>https://www.c-plusplus.net/forum/post/888235</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/888235</guid><dc:creator><![CDATA[Frage3432]]></dc:creator><pubDate>Sun, 09 Oct 2005 14:56:47 GMT</pubDate></item><item><title><![CDATA[Reply to vector sortieren on Sun, 09 Oct 2005 14:56:56 GMT]]></title><description><![CDATA[<p>Oder du implementierst operator &lt; (oder operator &gt;) und lässt dann sortieren.</p>
<p>Gruß</p>
]]></description><link>https://www.c-plusplus.net/forum/post/888236</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/888236</guid><dc:creator><![CDATA[FireFlow]]></dc:creator><pubDate>Sun, 09 Oct 2005 14:56:56 GMT</pubDate></item><item><title><![CDATA[Reply to vector sortieren on Sun, 09 Oct 2005 15:03:50 GMT]]></title><description><![CDATA[<p>Frage3432 schrieb:</p>
<blockquote>
<p>error C2678: Binärer Operator '&lt;': Es konnte kein Operator gefunden werden, der einen linksseitigen Operator vom Typ 'const std::string' akzeptiert (oder keine geeignete Konvertierung möglich)</p>
</blockquote>
<p>#include &lt;string&gt; vergessen? Zeig doch mal den Code.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/888238</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/888238</guid><dc:creator><![CDATA[MFK]]></dc:creator><pubDate>Sun, 09 Oct 2005 15:03:50 GMT</pubDate></item><item><title><![CDATA[Reply to vector sortieren on Sun, 09 Oct 2005 15:11:04 GMT]]></title><description><![CDATA[<p>MFK schrieb:</p>
<blockquote>
<p>Frage3432 schrieb:</p>
<blockquote>
<p>error C2678: Binärer Operator '&lt;': Es konnte kein Operator gefunden werden, der einen linksseitigen Operator vom Typ 'const std::string' akzeptiert (oder keine geeignete Konvertierung möglich)</p>
</blockquote>
<p>#include &lt;string&gt; vergessen? Zeig doch mal den Code.</p>
</blockquote>
<p>Stimmt, hatte ich vergessen.<br />
Jetzt bringt er mir aber das:</p>
<blockquote>
<p>error C2664: 'bool Sort_DAT_t1::operator ()(const DAT &amp;,const DAT &amp;)': Konvertierung des Parameters 1 von 'std::allocator&lt;_Ty&gt;::value_type' in 'const DAT &amp;' nicht möglich</p>
</blockquote>
]]></description><link>https://www.c-plusplus.net/forum/post/888248</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/888248</guid><dc:creator><![CDATA[Frage3432]]></dc:creator><pubDate>Sun, 09 Oct 2005 15:11:04 GMT</pubDate></item><item><title><![CDATA[Reply to vector sortieren on Sun, 09 Oct 2005 15:18:24 GMT]]></title><description><![CDATA[<p>MFK schrieb:</p>
<blockquote>
<p>Zeig doch mal den Code.</p>
</blockquote>
]]></description><link>https://www.c-plusplus.net/forum/post/888253</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/888253</guid><dc:creator><![CDATA[MFK]]></dc:creator><pubDate>Sun, 09 Oct 2005 15:18:24 GMT</pubDate></item><item><title><![CDATA[Reply to vector sortieren on Sun, 09 Oct 2005 15:34:24 GMT]]></title><description><![CDATA[<p>Sorry, hatte mich vertipp.<br />
Ich habe</p>
<blockquote>
<p>std::vector&lt;DAT*&gt; m_Daten;</p>
</blockquote>
<p>anstatt</p>
<blockquote>
<p>std::vector&lt;DAT&gt; m_Daten;</p>
</blockquote>
]]></description><link>https://www.c-plusplus.net/forum/post/888263</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/888263</guid><dc:creator><![CDATA[Frage3432]]></dc:creator><pubDate>Sun, 09 Oct 2005 15:34:24 GMT</pubDate></item><item><title><![CDATA[Reply to vector sortieren on Sun, 09 Oct 2005 15:41:14 GMT]]></title><description><![CDATA[<p>Was ich noch vergessen hatte, das Problem ist gelöst, vielen Dank für die schnelle Hilfe.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/888266</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/888266</guid><dc:creator><![CDATA[Frage3432]]></dc:creator><pubDate>Sun, 09 Oct 2005 15:41:14 GMT</pubDate></item></channel></rss>