<?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[Referenz zurückgeben.]]></title><description><![CDATA[<p>Hi!</p>
<pre><code class="language-cpp">wstring&amp; utf8_to_wchar_t ( const string&amp; s, wstring&amp; w )
{
// do the conversion job ...
// ...
return w; // Konvertierung war erfolgreich.
}
</code></pre>
<p>Macht das Sinn, bzw. ist das ok so, die Referenz auf das übergebene Objekt zurückzugeben, damit man mit dem Rückgabewert direkt weiterarbeiten kann?<br />
Oder gibts da Probleme, bzw. sind Probleme denkbar?<br />
Gruß,<br />
c.</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/246783/referenz-zurückgeben</link><generator>RSS for Node</generator><lastBuildDate>Thu, 17 Sep 2026 21:24:59 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/246783.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 01 Aug 2009 16:09:44 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Referenz zurückgeben. on Sat, 01 Aug 2009 16:09:44 GMT]]></title><description><![CDATA[<p>Hi!</p>
<pre><code class="language-cpp">wstring&amp; utf8_to_wchar_t ( const string&amp; s, wstring&amp; w )
{
// do the conversion job ...
// ...
return w; // Konvertierung war erfolgreich.
}
</code></pre>
<p>Macht das Sinn, bzw. ist das ok so, die Referenz auf das übergebene Objekt zurückzugeben, damit man mit dem Rückgabewert direkt weiterarbeiten kann?<br />
Oder gibts da Probleme, bzw. sind Probleme denkbar?<br />
Gruß,<br />
c.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1753621</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1753621</guid><dc:creator><![CDATA[convert0r]]></dc:creator><pubDate>Sat, 01 Aug 2009 16:09:44 GMT</pubDate></item><item><title><![CDATA[Reply to Referenz zurückgeben. on Sat, 01 Aug 2009 16:20:10 GMT]]></title><description><![CDATA[<p>Kann man so machen. Du zwingst den Nutzer aber, einen wstring vorher anzulegen.</p>
<p>Wenn Du keinen guten Grund hast, das folgende zu vermeiden</p>
<pre><code class="language-cpp">wstring utf8_to_wchar_t(const string&amp; s)
{
  //...
  wstring dings;
  //...
  return dings;
}
</code></pre>
<p>würde ich nämlich von Deiner Version abraten.</p>
<p>Gruß,<br />
SP</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1753628</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1753628</guid><dc:creator><![CDATA[Sebastian Pizer]]></dc:creator><pubDate>Sat, 01 Aug 2009 16:20:10 GMT</pubDate></item><item><title><![CDATA[Reply to Referenz zurückgeben. on Sat, 01 Aug 2009 16:34:51 GMT]]></title><description><![CDATA[<p>Ein Grund wäre da meiner Meinung nach das unnötige Kopieren bei der Übergabe in</p>
<pre><code class="language-cpp">wstring utf8_to_wchar_t(const string&amp; s)
</code></pre>
<p>Erst wird ein wstring erzeugt und dann beim Übergeben noch einmal kopiert. Erscheint mir als zusätzliche, vermeidbare Prozessorlast dieses Kopieren, rein gefühlsmäßig.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1753634</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1753634</guid><dc:creator><![CDATA[convert0r]]></dc:creator><pubDate>Sat, 01 Aug 2009 16:34:51 GMT</pubDate></item><item><title><![CDATA[Reply to Referenz zurückgeben. on Sat, 01 Aug 2009 16:43:00 GMT]]></title><description><![CDATA[<p>das wird automatisch vom compiler optimiert</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1753638</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1753638</guid><dc:creator><![CDATA[^^]]></dc:creator><pubDate>Sat, 01 Aug 2009 16:43:00 GMT</pubDate></item></channel></rss>