[Issue 19264] New: byCodeUnit should compare with strings

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Sep 25 15:55:38 UTC 2018


https://issues.dlang.org/show_bug.cgi?id=19264

          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 at puremagic.com
          Reporter: schveiguy at 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.

--


More information about the Digitalmars-d-bugs mailing list