https://www.ultimatepp.org/redmine/https://www.ultimatepp.org/redmine/redmine/favicon.ico2013-05-24T03:57:43ZRedmineU++ - Feature #460: Avoid the need of String().Cat() with moving << as String methodhttps://www.ultimatepp.org/redmine/issues/460?journal_id=9292013-05-24T03:57:43ZSender Ghost
<ul><li><strong>File</strong> <a href="/redmine/attachments/download/128/460_uppsrc.diff">460_uppsrc.diff</a><a href="/redmine/attachments/128/460_uppsrc.diff"><img alt="Magnifier" src="/redmine/images/magnifier.png" /></a> added</li><li><strong>Category</strong> set to <i>Core</i></li><li><strong>Status</strong> changed from <i>New</i> to <i>Patch ready</i></li><li><strong>Assignee</strong> set to <i>Miroslav Fidler</i></li></ul><p>If I understood correctly, it must be possible to do the following:<br /><pre><code class="cpp syntaxhl"><span class="CodeRay"><span class="preprocessor">#include</span> <span class="include"><Core/Core.h></span>
<span class="directive">using</span> <span class="keyword">namespace</span> Upp;
CONSOLE_APP_MAIN
{
String data = <span class="string"><span class="delimiter">"</span><span class="content">Some data</span><span class="delimiter">"</span></span>;
String text =
<span class="preprocessor">#if</span> <span class="integer">1</span>
String()
<span class="preprocessor">#else</span> <span class="comment">// as well as</span>
String().Cat()
<span class="preprocessor">#endif</span>
<< data << <span class="string"><span class="delimiter">"</span><span class="content"> and some text</span><span class="char">\n</span><span class="delimiter">"</span></span>;
Cout() << text;
}
</span></code></pre></p>
<p>The corresponding patch included.</p> U++ - Feature #460: Avoid the need of String().Cat() with moving << as String methodhttps://www.ultimatepp.org/redmine/issues/460?journal_id=9352013-05-25T08:40:06ZMiroslav Fidlercxl@ntllib.org
<ul></ul><p>Actually, that is only a partial solution. This should work too:</p>
<p>String text = String() << 123;</p>
<p>(-> method has to be the template)</p>
<p>Anyway, we have yet to decide whether this is a good idea after all...</p> U++ - Feature #460: Avoid the need of String().Cat() with moving << as String methodhttps://www.ultimatepp.org/redmine/issues/460?journal_id=9362013-05-25T08:40:18ZMiroslav Fidlercxl@ntllib.org
<ul><li><strong>Assignee</strong> changed from <i>Miroslav Fidler</i> to <i>Sender Ghost</i></li></ul> U++ - Feature #460: Avoid the need of String().Cat() with moving << as String methodhttps://www.ultimatepp.org/redmine/issues/460?journal_id=9452013-05-26T04:18:24ZSender Ghost
<ul><li><strong>File</strong> <a href="/redmine/attachments/download/132/460_uppsrc2.diff">460_uppsrc2.diff</a><a href="/redmine/attachments/132/460_uppsrc2.diff"><img alt="Magnifier" src="/redmine/images/magnifier.png" /></a> added</li><li><strong>Assignee</strong> changed from <i>Sender Ghost</i> to <i>Miroslav Fidler</i></li><li><strong>% Done</strong> changed from <i>0</i> to <i>100</i></li></ul><p>I created the second version of the patch, which solves the above case.</p> U++ - Feature #460: Avoid the need of String().Cat() with moving << as String methodhttps://www.ultimatepp.org/redmine/issues/460?journal_id=9462013-05-26T05:01:22ZSender Ghost
<ul></ul><p>Miroslav Fidler wrote:</p>
<blockquote>
<p>Anyway, we have yet to decide whether this is a good idea after all...</p>
</blockquote>
<p>I think, the methods are equal (because of using almost the same inlined versions).<br />The sizes of applications, compiled with (MinGW) GCC and MSC for current and new methods, are the same.</p>
<p>The main purpose is to "help" GCC compiler (where MSC compiler is ok for current and new methods) to understand:</p>
<blockquote>
<p>conversion for argument 1 from 'Upp::String' to 'Upp::String&'.</p>
</blockquote> U++ - Feature #460: Avoid the need of String().Cat() with moving << as String methodhttps://www.ultimatepp.org/redmine/issues/460?journal_id=9472013-05-26T07:55:20ZSender Ghost
<ul><li><strong>File</strong> <a href="/redmine/attachments/download/133/460_conversion.diff">460_conversion.diff</a><a href="/redmine/attachments/133/460_conversion.diff"><img alt="Magnifier" src="/redmine/images/magnifier.png" /></a> added</li></ul><p>Also I created the patch for global conversion of <strong>String().Cat()</strong> to <strong>String()</strong> following directories:</p>
<blockquote>
<p>bazaar, examples, rainbow, reference, tutorial, uppbox, uppdev, uppsrc, upptst.</p>
</blockquote> U++ - Feature #460: Avoid the need of String().Cat() with moving << as String methodhttps://www.ultimatepp.org/redmine/issues/460?journal_id=29062016-05-08T06:17:12ZMiroslav Fidlercxl@ntllib.org
<ul><li><strong>Status</strong> changed from <i>Patch ready</i> to <i>Rejected</i></li></ul><p>Resolved with C++11 &&</p>