Feature #460
Avoid the need of String().Cat() with moving << as String method
Status: | Rejected | Start date: | 04/19/2013 | |
---|---|---|---|---|
Priority: | Normal | Due date: | ||
Assignee: | Miroslav Fidler | % Done: | 100% | |
Category: | Core | Spent time: | - | |
Target version: | - |
History
#1 Updated by Sender Ghost almost 12 years ago
- File 460_uppsrc.diff
added
- Category set to Core
- Status changed from New to Patch ready
- Assignee set to Miroslav Fidler
If I understood correctly, it must be possible to do the following:
#include <Core/Core.h>
using namespace Upp;
CONSOLE_APP_MAIN
{
String data = "Some data";
String text =
#if 1
String()
#else // as well as
String().Cat()
#endif
<< data << " and some text\n";
Cout() << text;
}
The corresponding patch included.
#2 Updated by Miroslav Fidler almost 12 years ago
Actually, that is only a partial solution. This should work too:
String text = String() << 123;
(-> method has to be the template)
Anyway, we have yet to decide whether this is a good idea after all...
#3 Updated by Miroslav Fidler almost 12 years ago
- Assignee changed from Miroslav Fidler to Sender Ghost
#4 Updated by Sender Ghost almost 12 years ago
- File 460_uppsrc2.diff
added
- Assignee changed from Sender Ghost to Miroslav Fidler
- % Done changed from 0 to 100
I created the second version of the patch, which solves the above case.
#5 Updated by Sender Ghost almost 12 years ago
Miroslav Fidler wrote:
Anyway, we have yet to decide whether this is a good idea after all...
I think, the methods are equal (because of using almost the same inlined versions).
The sizes of applications, compiled with (MinGW) GCC and MSC for current and new methods, are the same.
The main purpose is to "help" GCC compiler (where MSC compiler is ok for current and new methods) to understand:
conversion for argument 1 from 'Upp::String' to 'Upp::String&'.
#6 Updated by Sender Ghost almost 12 years ago
- File 460_conversion.diff
added
Also I created the patch for global conversion of String().Cat() to String() following directories:
bazaar, examples, rainbow, reference, tutorial, uppbox, uppdev, uppsrc, upptst.
#7 Updated by Miroslav Fidler almost 9 years ago
- Status changed from Patch ready to Rejected
Resolved with C++11 &&