<?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[Letztes Wort loeschen]]></title><description><![CDATA[<p>Ich habe gerade eine Methode geschrieben die das letzte Wort in einer Zeile löscht. Nun wollte ich mal nach fragen ob man das noch kürzer machen kann? Ich habe kaum Erfahrung mit C++-Strings.</p>
<pre><code>for(string::reverse_iterator i = _text.rbegin(); i != _text.rend(); ++i)
        {
            if (*i != ' ')
                _text.pop_back();
            else
                break;
        }
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/topic/321671/letztes-wort-loeschen</link><generator>RSS for Node</generator><lastBuildDate>Sun, 19 Jul 2026 06:04:56 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/321671.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 20 Nov 2013 19:06:55 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Letztes Wort loeschen on Wed, 20 Nov 2013 19:06:55 GMT]]></title><description><![CDATA[<p>Ich habe gerade eine Methode geschrieben die das letzte Wort in einer Zeile löscht. Nun wollte ich mal nach fragen ob man das noch kürzer machen kann? Ich habe kaum Erfahrung mit C++-Strings.</p>
<pre><code>for(string::reverse_iterator i = _text.rbegin(); i != _text.rend(); ++i)
        {
            if (*i != ' ')
                _text.pop_back();
            else
                break;
        }
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/2366631</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2366631</guid><dc:creator><![CDATA[CppNeuland]]></dc:creator><pubDate>Wed, 20 Nov 2013 19:06:55 GMT</pubDate></item><item><title><![CDATA[Reply to Letztes Wort loeschen on Wed, 20 Nov 2013 19:17:38 GMT]]></title><description><![CDATA[<p>Mag sein, dass man das noch irgendwie in ein paar weniger Zeichen quetschen kann, aber an sich ist die Lösung ganz ok. Der Algorithmus kann nicht wesentlich verbessert werden und die Umsetzung ist ebenfalls gut und lesbar.</p>
<p>edit: Nein, ist gar nicht ok. pop_back kann die Iteratoren ungültig machen. Hätte ich jetzt intuitiv nicht erwartet, aber was der Standard sagt ist eben so und man sollte sich dran halten. Dann würde ich den Algorithmus ändern zu: Von hinten letztes Space suchen (z.B. find_last_of, aber gerne auch anders), dann gucken, ob das Suchergebnis gültig ist (also überhaupt ein Space vorhanden), dann ab dem Space bis zum Ende löschen (mittels erase). Dabei muss man noch definieren, ob man bei nur einem Wort ebenfalls das letzte Wort löschen möchte, siehe Sonderfall, wenn kein Space vorhanden ist.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2366635</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2366635</guid><dc:creator><![CDATA[SeppJ]]></dc:creator><pubDate>Wed, 20 Nov 2013 19:17:38 GMT</pubDate></item><item><title><![CDATA[Reply to Letztes Wort loeschen on Wed, 20 Nov 2013 19:17:15 GMT]]></title><description><![CDATA[<p>Ok, danke. Ja, lesbar sollte es schon noch bleiben.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2366637</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2366637</guid><dc:creator><![CDATA[CppNeuland]]></dc:creator><pubDate>Wed, 20 Nov 2013 19:17:15 GMT</pubDate></item><item><title><![CDATA[Reply to Letztes Wort loeschen on Wed, 20 Nov 2013 19:18:26 GMT]]></title><description><![CDATA[<p>CppNeuland schrieb:</p>
<blockquote>
<p>Ok, danke. Ja, lesbar sollte es schon noch bleiben.</p>
</blockquote>
<p>Ich habe noch einen Fehler entdeckt und oben eine Erklärung rein editiert, während du meine (uneditierte) Antwort gelesen hast. Den Fehler solltest du dir ansehen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2366639</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2366639</guid><dc:creator><![CDATA[SeppJ]]></dc:creator><pubDate>Wed, 20 Nov 2013 19:18:26 GMT</pubDate></item><item><title><![CDATA[Reply to Letztes Wort loeschen on Wed, 20 Nov 2013 19:30:27 GMT]]></title><description><![CDATA[<p>SeppJ schrieb:</p>
<blockquote>
<p>Nein, ist gar nicht ok. pop_back kann die Iteratoren ungültig machen.</p>
</blockquote>
<p>Echt?<br />
Beim vector bleiben doch Iteratoren nach erase gültig, so lange sie nicht hinter den Bereich zeigen, der gelöscht wird.<br />
Und string ist doch im Inneren vector. Oder ist da was ganz falsch?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2366645</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2366645</guid><dc:creator><![CDATA[Nathan]]></dc:creator><pubDate>Wed, 20 Nov 2013 19:30:27 GMT</pubDate></item><item><title><![CDATA[Reply to Letztes Wort loeschen on Wed, 20 Nov 2013 19:34:19 GMT]]></title><description><![CDATA[<p>Nathan schrieb:</p>
<blockquote>
<p>SeppJ schrieb:</p>
<blockquote>
<p>Nein, ist gar nicht ok. pop_back kann die Iteratoren ungültig machen.</p>
</blockquote>
<p>Echt?<br />
Beim vector bleiben doch Iteratoren nach erase gültig, so lange sie nicht hinter den Bereich zeigen, der gelöscht wird.<br />
Und string ist doch im Inneren vector. Oder ist da was ganz falsch?</p>
</blockquote>
<p>Beim vector ist nachher immer noch alles gültig.</p>
<p>Das Interface von std::string soll aber SSO-geeignet sein und der Inhalt darf bei pop_back in den String reingepackt werden.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2366650</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2366650</guid><dc:creator><![CDATA[mr. wrong]]></dc:creator><pubDate>Wed, 20 Nov 2013 19:34:19 GMT</pubDate></item><item><title><![CDATA[Reply to Letztes Wort loeschen on Wed, 20 Nov 2013 19:48:50 GMT]]></title><description><![CDATA[<p>Nathan schrieb:</p>
<blockquote>
<p>SeppJ schrieb:</p>
<blockquote>
<p>Nein, ist gar nicht ok. pop_back kann die Iteratoren ungültig machen.</p>
</blockquote>
<p>Echt?</p>
</blockquote>
<p>Ja, mich hat's auch überrascht, aber ich habe es extra nochmal nach geguckt.</p>
<p>mr. wrong  schrieb:</p>
<blockquote>
<p>Das Interface von std::string soll aber SSO-geeignet sein und der Inhalt darf bei pop_back in den String reingepackt werden.</p>
</blockquote>
<p>Das wird wohl der Grund sein. Alternativ bei Copy on write Optimierung (also das, was vor C++11 üblich war) gilt das auch. Daher war wohl auch erase beim string immer schon eine Funktion, die <strong>alle</strong> Iteratoren und Zeiger ungültig macht (pop_back ist neu in C++11).</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2366656</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2366656</guid><dc:creator><![CDATA[SeppJ]]></dc:creator><pubDate>Wed, 20 Nov 2013 19:48:50 GMT</pubDate></item><item><title><![CDATA[Reply to Letztes Wort loeschen on Wed, 20 Nov 2013 20:18:07 GMT]]></title><description><![CDATA[<p>SeppJ schrieb:</p>
<blockquote>
<p>Der Algorithmus kann nicht wesentlich verbessert werden und die Umsetzung ist ebenfalls gut und lesbar.</p>
</blockquote>
<p>Völlig falsch!</p>
<pre><code class="language-cpp">#include &lt;iostream&gt;
#include &lt;algorithm&gt;
#include &lt;cassert&gt;
#include &lt;string&gt;
#include &lt;chrono&gt;

void neuland(std::string &amp;s)
{
  std::string::reverse_iterator i;
  for(i = s.rbegin(); i != s.rend(); ++i)
    if (*i == ' ')
      break;
  s.erase(i.base()-1, s.end());
}

void mrwrong(std::string&amp; s)
{
  const char x = ' ';
  __m128i zero = _mm_setzero_si128();
  __m128i cx16 = _mm_set1_epi8(x);
  const char *start=s.c_str(), *b = start + s.size();
  for (int i=s.size()%16;i--;)
    if (*--b == x)
      goto end;
  for (b -= 16;; b -= 16) {
    __m128i  x = _mm_loadu_si128((__m128i const *)b);
    unsigned u = _mm_movemask_epi8(_mm_cmpeq_epi8(zero, x));
    unsigned v = _mm_movemask_epi8(_mm_cmpeq_epi8(cx16, x)) &amp; ~u &amp; (u - 1);
    if (v) { b += __builtin_ctz(v); goto end; }
    if (__builtin_expect(b == start,0)) { return; }
  }
 end:
  s.erase(b - start);
}

template &lt;typename F, typename... T&gt;
void mesure(const char *name, F f, T&amp;&amp;... args)
{
  auto start = std::chrono::high_resolution_clock::now();
  f(std::forward&lt;T&gt;(args)...);
  auto stop = std::chrono::high_resolution_clock::now();

  std::cout &lt;&lt; name &lt;&lt; &quot;: &quot;
            &lt;&lt; std::chrono::duration_cast&lt;std::chrono::nanoseconds&gt;(stop-start).count()
            &lt;&lt; &quot; ns&quot; &lt;&lt; std::endl;
}

template &lt;typename F&gt;
void test(const char *name, F f)
{
  const int size=10000000;
  static std::string s; s.clear();
  while (s.size() &lt; size)
    s.push_back(rand()%26 + 'a');
  unsigned x = rand()%16;
  s[x] = ' ';
  mesure(name, f, s);
  assert(s.size() == x);
}

int main()
{
  srand(0);
  for (int i=0; i&lt;16; ++i) {
    test(&quot;mrwrong&quot;, [](std::string&amp;s){mrwrong(s);});
    test(&quot;neuland&quot;, [](std::string&amp;s){neuland(s);});
  }
}
</code></pre>
<p>erzeugt bei mir:</p>
<pre><code>mrwrong: 4629926 ns
neuland: 15678281 ns
mrwrong: 3502405 ns
neuland: 15370140 ns
mrwrong: 3446578 ns
neuland: 15330838 ns
mrwrong: 3500771 ns
neuland: 15379725 ns
mrwrong: 3590104 ns
neuland: 15347023 ns
mrwrong: 3565236 ns
neuland: 15342064 ns
mrwrong: 3580317 ns
neuland: 15345939 ns
mrwrong: 3636245 ns
neuland: 15349274 ns
...
</code></pre>
<p>Also Faktor 5 Unterschied. Der Unterschied dürfte bei neueren Prozessoren mit mehr SSE-Unterstützung noch grösser sein.</p>
<p>Etwa gleich schnell ist</p>
<pre><code class="language-cpp">void alternative(std::string &amp;s)
{
  s.erase(strrchr(s.c_str(), ' ') - s.c_str());
}
</code></pre>
<p>aber nur, wenn der Character ' ' am Anfang ist, im anzunehmenden Fall, dass das Whitespace eher am Ende zu finden ist, ist das sogar schlechter als die neuland-Variante.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2366669</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2366669</guid><dc:creator><![CDATA[mr. wrong]]></dc:creator><pubDate>Wed, 20 Nov 2013 20:18:07 GMT</pubDate></item><item><title><![CDATA[Reply to Letztes Wort loeschen on Wed, 20 Nov 2013 20:53:36 GMT]]></title><description><![CDATA[<p>mr. wrong schrieb:</p>
<blockquote>
<pre><code class="language-cpp">void mrwrong(std::string&amp; s)
{
  const char x = ' ';
  __m128i zero = _mm_setzero_si128();
  __m128i cx16 = _mm_set1_epi8(x);
  const char *start=s.c_str(), *b = start + s.size();
  for (int i=s.size()%16;i--;)
    if (*--b == x)
      goto end;
  for (b -= 16;; b -= 16) {
    __m128i  x = _mm_loadu_si128((__m128i const *)b);
    unsigned u = _mm_movemask_epi8(_mm_cmpeq_epi8(zero, x));
    unsigned v = _mm_movemask_epi8(_mm_cmpeq_epi8(cx16, x)) &amp; ~u &amp; (u - 1);
    if (v) { b += __builtin_ctz(v); goto end; }
    if (__builtin_expect(b == start,0)) { return; }
  }
 end:
  s.erase(b - start);
}
</code></pre>
</blockquote>
<p><img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f44d.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--thumbs_up"
      title=":+1:"
      alt="👍"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/2366683</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2366683</guid><dc:creator><![CDATA[Nathan]]></dc:creator><pubDate>Wed, 20 Nov 2013 20:53:36 GMT</pubDate></item><item><title><![CDATA[Reply to Letztes Wort loeschen on Wed, 20 Nov 2013 21:20:22 GMT]]></title><description><![CDATA[<p>Das muss ich erst mal verdauen, da lernt man doch die Profis schätzen. <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f62e.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--face_with_open_mouth"
      title=":open_mouth:"
      alt="😮"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/2366689</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2366689</guid><dc:creator><![CDATA[CppNeuland]]></dc:creator><pubDate>Wed, 20 Nov 2013 21:20:22 GMT</pubDate></item><item><title><![CDATA[Reply to Letztes Wort loeschen on Wed, 20 Nov 2013 22:08:53 GMT]]></title><description><![CDATA[<p>bedenke aber, dass der Code mr. wongs code plattform- und compilerabhängig ist.<br />
Wenn es weiterhin unabhängig sein soll, musst du schon mit präprozessorcommandos etwas basteln, um im Notfall auf deine alte Methode zurückzuspringen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2366696</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2366696</guid><dc:creator><![CDATA[Marthog]]></dc:creator><pubDate>Wed, 20 Nov 2013 22:08:53 GMT</pubDate></item><item><title><![CDATA[Reply to Letztes Wort loeschen on Thu, 21 Nov 2013 06:05:02 GMT]]></title><description><![CDATA[<p>Unabhängig vom OS sollte es schon sein. Ich programmiere mit dem Qt-Creator unter OSX und die Sachen sollten dann aber auch unter Linux, Windows und Android laufen.</p>
<p>Nichts desto Trotz ist die Lösung von MrWrong schon beeindruckend. Ich habe früher auf dem Amiga mit dem Seka-Assembler so Demos programmiert und daher ist eine Restfaszination für die einzig reale Computersprache immer noch da.</p>
<p>Mittlerweile bin ich aber über die vielen Abstraktionsebenen doch froh <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f603.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--grinning_face_with_big_eyes"
      title=":D"
      alt="😃"
    /></p>
<p>EDIT: So, ohne Spezialfälle habe ich es jetzt so gelöst. Gibt es damit auch Probleme?</p>
<pre><code>_text.erase(_text.find_last_of(' '));
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/2366726</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2366726</guid><dc:creator><![CDATA[CppNeuland]]></dc:creator><pubDate>Thu, 21 Nov 2013 06:05:02 GMT</pubDate></item><item><title><![CDATA[Reply to Letztes Wort loeschen on Thu, 21 Nov 2013 10:01:26 GMT]]></title><description><![CDATA[<p>CppNeuland schrieb:</p>
<blockquote>
<p>EDIT: So, ohne Spezialfälle habe ich es jetzt so gelöst. Gibt es damit auch Probleme?</p>
<pre><code>_text.erase(_text.find_last_of(' '));
</code></pre>
</blockquote>
<p>Ja, string::erase() löst eine out_of_range exception aus falls im string kein Leerzeichen gefunden wird (find_last_of() == string::npos).</p>
<p><strong>- osdt</strong></p>
]]></description><link>https://www.c-plusplus.net/forum/post/2366748</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2366748</guid><dc:creator><![CDATA[osdt]]></dc:creator><pubDate>Thu, 21 Nov 2013 10:01:26 GMT</pubDate></item><item><title><![CDATA[Reply to Letztes Wort loeschen on Thu, 21 Nov 2013 10:20:31 GMT]]></title><description><![CDATA[<p>Nathan schrieb:</p>
<blockquote>
<p>mr. wrong schrieb:</p>
<blockquote>
<pre><code class="language-cpp">void mrwrong(std::string&amp; s)
{
  const char x = ' ';
  __m128i zero = _mm_setzero_si128();
  __m128i cx16 = _mm_set1_epi8(x);
  const char *start=s.c_str(), *b = start + s.size();
  for (int i=s.size()%16;i--;)
    if (*--b == x)
      goto end;
  for (b -= 16;; b -= 16) {
    __m128i  x = _mm_loadu_si128((__m128i const *)b);
    unsigned u = _mm_movemask_epi8(_mm_cmpeq_epi8(zero, x));
    unsigned v = _mm_movemask_epi8(_mm_cmpeq_epi8(cx16, x)) &amp; ~u &amp; (u - 1);
    if (v) { b += __builtin_ctz(v); goto end; }
    if (__builtin_expect(b == start,0)) { return; }
  }
 end:
  s.erase(b - start);
}
</code></pre>
</blockquote>
<p><img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f44d.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--thumbs_up"
      title=":+1:"
      alt="👍"
    /></p>
</blockquote>
<p>Ich dachte bis jetzt &quot;goto&quot; soll man nicht verwenden?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2366756</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2366756</guid><dc:creator><![CDATA[Ruvi++]]></dc:creator><pubDate>Thu, 21 Nov 2013 10:20:31 GMT</pubDate></item><item><title><![CDATA[Reply to Letztes Wort loeschen on Thu, 21 Nov 2013 10:29:46 GMT]]></title><description><![CDATA[<pre><code>mrwrong: 1531876 ns
arcoth: 3441873 ns
neuland: 5500253 ns
[...]
mrwrong: 968054  ns
arcoth : 3047209 ns
neuland: 4573583 ns
mrwrong: 958147  ns
arcoth : 3222022 ns
neuland: 4567348 ns
</code></pre>
<p>Die Ausgabe bekomme ich, wenn ich mrwrongs, CppNeulands neuesten und <a href="http://codepad.org/7PT68Koi" rel="nofollow">meinen</a> Code, der im Übrigen - soweit ich sehe - plattformunabhängig ist, vergleiche. Am meisten unnötige Zeit schluckt wohl die Funktion</p>
<pre><code>qword qword_from( char const* p )
{
	return  *p
	       | ( qword(p[1]) &lt;&lt; 8 )
	       | ( qword(p[2]) &lt;&lt; 16 )
	       | ( qword(p[3]) &lt;&lt; 24 )
	       | ( qword(p[4]) &lt;&lt; 32 )
	       | ( qword(p[5]) &lt;&lt; 40 )
	       | ( qword(p[6]) &lt;&lt; 48 )
	       | ( qword(p[7]) &lt;&lt; 56 );
}
</code></pre>
<p>, dafür nimmt mrwrong in seiner Variante natürlich <code>_mm_loadu_si128</code> . Wenn ich stattdessen die UB-Methode nehme,</p>
<pre><code>qword qword_from( char const* p )
{
	return *reinterpret_cast&lt;qword const*&gt;(p);
}
</code></pre>
<p>bekomme ich etwa</p>
<pre><code>mrwrong: 1502699 ns
arcoth : 1395314 ns
neuland: 7582803 ns
[...]
mrwrong: 981523  ns
arcoth : 1093849 ns
neuland: 4553076 ns
mrwrong: 887963  ns
arcoth : 1098256 ns
neuland: 4938181 ns
</code></pre>
<blockquote>
<p>Ich dachte bis jetzt &quot;goto&quot; soll man nicht verwenden?</p>
</blockquote>
<p>Das ist nur eine Faustregel, um Spaghetti-Code zu vermeiden. Hier vereinfacht es den Code.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2366761</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2366761</guid><dc:creator><![CDATA[Columbo]]></dc:creator><pubDate>Thu, 21 Nov 2013 10:29:46 GMT</pubDate></item><item><title><![CDATA[Reply to Letztes Wort loeschen on Thu, 21 Nov 2013 14:26:28 GMT]]></title><description><![CDATA[<p>osdt schrieb:</p>
<blockquote>
<p>CppNeuland schrieb:</p>
<blockquote>
<p>EDIT: So, ohne Spezialfälle habe ich es jetzt so gelöst. Gibt es damit auch Probleme?</p>
<pre><code>_text.erase(_text.find_last_of(' '));
</code></pre>
</blockquote>
<p>Ja, string::erase() löst eine out_of_range exception aus falls im string kein Leerzeichen gefunden wird (find_last_of() == string::npos).</p>
<p><strong>- osdt</strong></p>
</blockquote>
<p>Aja, na dann versuche ich es mal so:</p>
<pre><code>size_t pos = _text.find_last_of(' ');
        if ( pos != string::npos )
            _text.erase(pos);
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/2366821</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2366821</guid><dc:creator><![CDATA[CppNeuland]]></dc:creator><pubDate>Thu, 21 Nov 2013 14:26:28 GMT</pubDate></item><item><title><![CDATA[Reply to Letztes Wort loeschen on Thu, 21 Nov 2013 15:07:01 GMT]]></title><description><![CDATA[<p>Und wenn der ganze String ein Wort ist?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2366832</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2366832</guid><dc:creator><![CDATA[Arcoth_logoff]]></dc:creator><pubDate>Thu, 21 Nov 2013 15:07:01 GMT</pubDate></item><item><title><![CDATA[Reply to Letztes Wort loeschen on Thu, 21 Nov 2013 15:29:27 GMT]]></title><description><![CDATA[<p>Spezialfälle habe ich jetzt nicht mit drin, aber in diesem Fall wird ja erase übersprungen. Die ganze Sache ist eh nur um das Command Pattern mal an einem konkreten Minimalbeispiel mir klar zu machen. Das wird also nie so irgendwie produktiv laufen.</p>
<p>Ich hatte halt zwei Beispielklassen mit Text, eine kann Zeichen hinzufügen und das letzte Zeichen löschen und eine kann dies mit Worten tun. Und beim Wort löschen kam ich dann auf die erste Lösung hier...der Rest ist bekannt.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2366837</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2366837</guid><dc:creator><![CDATA[CppNeuland]]></dc:creator><pubDate>Thu, 21 Nov 2013 15:29:27 GMT</pubDate></item></channel></rss>