<?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[Zwei Vektoren vom Typ bool XOR-Verknüpfen]]></title><description><![CDATA[<p>Hallo alle zusammen,</p>
<p>ich habe eine Funktion geschrieben um zwei Vektoren vom Typ bool miteinander XOR zu verknüpfen:</p>
<pre><code class="language-cpp">vector&lt;bool&gt; VecBoolXOR(vector&lt;bool&gt; a, vector&lt;bool&gt; b){
    vector&lt;bool&gt;::iterator VBI_A = a.begin();
    for(vector&lt;bool&gt;::iterator VBI_B = b.begin(); VBI_B != b.end(); ++VBI_B){
        *VBI_A = *VBI_A ^ *VBI_B;
        ++VBI_A;
    }
    return a;
}
</code></pre>
<p>Kennt jemand eine möglichkeit das ganze noch schneller zu lösen?<br />
Eventuell auch mit einer anderen Architektur als vector&lt;bool&gt;, sie muss jedoch Größenvariabel sein.</p>
<p>Ich würde mich über jede antwort freuen.</p>
<p>MfG Mars337</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/309161/zwei-vektoren-vom-typ-bool-xor-verknüpfen</link><generator>RSS for Node</generator><lastBuildDate>Wed, 05 Aug 2026 11:18:33 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/309161.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 15 Oct 2012 19:35:36 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Zwei Vektoren vom Typ bool XOR-Verknüpfen on Mon, 15 Oct 2012 19:35:36 GMT]]></title><description><![CDATA[<p>Hallo alle zusammen,</p>
<p>ich habe eine Funktion geschrieben um zwei Vektoren vom Typ bool miteinander XOR zu verknüpfen:</p>
<pre><code class="language-cpp">vector&lt;bool&gt; VecBoolXOR(vector&lt;bool&gt; a, vector&lt;bool&gt; b){
    vector&lt;bool&gt;::iterator VBI_A = a.begin();
    for(vector&lt;bool&gt;::iterator VBI_B = b.begin(); VBI_B != b.end(); ++VBI_B){
        *VBI_A = *VBI_A ^ *VBI_B;
        ++VBI_A;
    }
    return a;
}
</code></pre>
<p>Kennt jemand eine möglichkeit das ganze noch schneller zu lösen?<br />
Eventuell auch mit einer anderen Architektur als vector&lt;bool&gt;, sie muss jedoch Größenvariabel sein.</p>
<p>Ich würde mich über jede antwort freuen.</p>
<p>MfG Mars337</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2260810</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2260810</guid><dc:creator><![CDATA[Mars337]]></dc:creator><pubDate>Mon, 15 Oct 2012 19:35:36 GMT</pubDate></item><item><title><![CDATA[Reply to Zwei Vektoren vom Typ bool XOR-Verknüpfen on Mon, 15 Oct 2012 19:41:03 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">std::transform(a.begin(), a.end(), b.begin(), outputItr, std::bit_xor&lt;bool&gt;());
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/2260811</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2260811</guid><dc:creator><![CDATA[Nexus]]></dc:creator><pubDate>Mon, 15 Oct 2012 19:41:03 GMT</pubDate></item><item><title><![CDATA[Reply to Zwei Vektoren vom Typ bool XOR-Verknüpfen on Mon, 15 Oct 2012 20:09:08 GMT]]></title><description><![CDATA[<p>wenn es um geschwindigkeit geht, bist du uU mit vector&lt;char&gt; schneller als mit vector&lt;bool&gt;...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2260820</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2260820</guid><dc:creator><![CDATA[Shade Of Mine]]></dc:creator><pubDate>Mon, 15 Oct 2012 20:09:08 GMT</pubDate></item><item><title><![CDATA[Reply to Zwei Vektoren vom Typ bool XOR-Verknüpfen on Mon, 15 Oct 2012 20:18:54 GMT]]></title><description><![CDATA[<p><a href="http://www.boost.org/libs/dynamic_bitset/" rel="nofollow">Boost.DynamicBitset</a> dürfte etwas für dich sein. Ist garantiert schneller als vector&lt;bool&gt; und der vector&lt;signed char&gt; von Shade.</p>
<p>Lässt sich sonst auch selber nachbauen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2260824</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2260824</guid><dc:creator><![CDATA[performanceboost]]></dc:creator><pubDate>Mon, 15 Oct 2012 20:18:54 GMT</pubDate></item><item><title><![CDATA[Reply to Zwei Vektoren vom Typ bool XOR-Verknüpfen on Wed, 17 Oct 2012 18:01:05 GMT]]></title><description><![CDATA[<p>Hey <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>Danke an euch, habe direkt mal die Lösung von Nexus probiert, funktioniert einwandfrei <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>Gibt es für diese Funktion auch die Möglichkeit nur Teile eines Vektors zu verwenden?</p>
<p>Als Beispiel habe ich zwei Vektoren mit Zehn Elementen, möchte aber nur die Elemente 3-7 beider Vektoren XOR-Verknüpfen.</p>
<p>Bis hier hin schonmal tausend Dank euch <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>MfG Mars337</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2261463</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2261463</guid><dc:creator><![CDATA[Mars337]]></dc:creator><pubDate>Wed, 17 Oct 2012 18:01:05 GMT</pubDate></item><item><title><![CDATA[Reply to Zwei Vektoren vom Typ bool XOR-Verknüpfen on Wed, 17 Oct 2012 18:12:08 GMT]]></title><description><![CDATA[<p>Mars337 schrieb:</p>
<blockquote>
<p>Hey <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>Danke an euch, habe direkt mal die Lösung von Nexus probiert, funktioniert einwandfrei <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>Gibt es für diese Funktion auch die Möglichkeit nur Teile eines Vektors zu verwenden?</p>
<p>Als Beispiel habe ich zwei Vektoren mit Zehn Elementen, möchte aber nur die Elemente 3-7 beider Vektoren XOR-Verknüpfen.</p>
<p>Bis hier hin schonmal tausend Dank euch <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>MfG Mars337</p>
</blockquote>
<p>Ja natürlich! Wozu existiert denn das Iteratoren-Konzept?! Und dazu wird es noch einfacher, da die Iteratoren von <code>std::vector</code> random-access sind.</p>
<p>Ich nehme mal an, du meinst ein rechtsoffenes Intervall [3, 7)? Also drittes Element inklusive, siebtes exklusive?</p>
<pre><code class="language-cpp">std::transform(a.begin() + 2, 
               a.end() + 6, 
               b.begin() + 2, 
               outputItr, 
               std::bit_xor&lt;bool&gt;());
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/2261467</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2261467</guid><dc:creator><![CDATA[Sone]]></dc:creator><pubDate>Wed, 17 Oct 2012 18:12:08 GMT</pubDate></item><item><title><![CDATA[Reply to Zwei Vektoren vom Typ bool XOR-Verknüpfen on Wed, 17 Oct 2012 18:19:58 GMT]]></title><description><![CDATA[<p>Ganz genau!<br />
Nochmals vielen Dank <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/2261472</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2261472</guid><dc:creator><![CDATA[Mars337]]></dc:creator><pubDate>Wed, 17 Oct 2012 18:19:58 GMT</pubDate></item></channel></rss>