www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 19264] New: byCodeUnit should compare with strings


          Issue ID: 19264
           Summary: byCodeUnit should compare with strings
           Product: D
           Version: D2
          Hardware: x86
                OS: Mac OS X
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: phobos
          Assignee: nobody puremagic.com
          Reporter: schveiguy yahoo.com

In order for byCodeUnit to be a near drop-in replacement for strings, it would
be nice to have them compare directly with strings.

This means, I would expect this to work:

assert("hello".byCodeUnit == "hello");

This probably means adding opEquals overloads for everything, which also means
adding toHash overloads.

I'd say just comparing to the base type should be sufficient, no need for
transcoding for comparison.

Sep 25 2018