Why are enums with base type string not considered strings?

wolframw wolframw at protonmail.com
Sun Mar 14 10:42:17 UTC 2021


enum BoolEnum   : bool   { TestBool   = false }
enum CharEnum   : char   { TestChar   = 'A' }
enum StringEnum : string { TestString = "Hello" }

pragma(msg, isBoolean!BoolEnum);       // true
pragma(msg, isSomeChar!CharEnum);      // true
pragma(msg, isSomeString!StringEnum);  // false

Why does isSomeString not return true for an enum with base type 
string while
other isX functions return true for enums with an according base 
type X?
Regarding whether enums should be considered by these functions, 
I can see the
case being made one of both ways (personally, I'd say they 
should), but in the
example above it seems that different rules are applied.


More information about the Digitalmars-d-learn mailing list