August 16, 2020
https://issues.dlang.org/show_bug.cgi?id=21168

          Issue ID: 21168
           Summary: std.utf.decode front/back should be able to decode
                    using enum character types
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: phobos
          Assignee: nobody@puremagic.com
          Reporter: schveiguy@yahoo.com

Came across this while working on removing autodecoding.

If you have an enum that derives from char (this comes from
std.algorithm.comparison):

enum EditOp : char
{
   none = 'n',
   substitute = 's',
   insert = 'i',
   remove = 'r'
}

Then isSomeChar!EditOp is true.

However, EditOp[].byDchar does not work, because decodeFront cannot handle EditOp. The reason is because the decodeImpl return structure is hard coded to only accept char, wchar, or dchar EXACTLY.

Instead it should accept any range that has a character element type, and check the size of the character to ensure it works (this is purely a template constraint problem, the code works fine once you fix it).

--