Feature #460

Avoid the need of String().Cat() with moving << as String method

Added by Miroslav Fidler over 7 years ago. Updated over 4 years ago.

Status:RejectedStart date:04/19/2013
Priority:NormalDue date:
Assignee:Miroslav Fidler% Done:

100%

Category:CoreSpent time:-
Target version:-

460_uppsrc.diff Magnifier - The diff file to apply for uppsrc directory (1.03 KB) Sender Ghost, 05/24/2013 05:57 AM

460_uppsrc2.diff Magnifier - The diff file to apply for uppsrc directory (second version) (2.71 KB) Sender Ghost, 05/26/2013 06:18 AM

460_conversion.diff Magnifier - The diff file to apply for bazaar, examples, rainbow, reference, tutorial, uppbox, uppdev, uppsrc, upptst directories (76.4 KB) Sender Ghost, 05/26/2013 09:55 AM

History

#1 Updated by Sender Ghost over 7 years ago

  • File 460_uppsrc.diffMagnifier 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 over 7 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 over 7 years ago

  • Assignee changed from Miroslav Fidler to Sender Ghost

#4 Updated by Sender Ghost over 7 years ago

  • File 460_uppsrc2.diffMagnifier 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 over 7 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 over 7 years ago

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 over 4 years ago

  • Status changed from Patch ready to Rejected

Resolved with C++11 &&

Also available in: Atom PDF