I am using the MT4 enumeration for a selection input:
enum ENUM_myChoice{
a, b, c, e, f, g
};
The problem is if I have to add "d
" to the list in alphabetical order,
all of my templates using e
, f
or g
are ruined because they are off by 1.
Is there an elegant solution to this or only brute force?
Thanks in advance
How the MQL4
enum anEnumNAME{...};
syntax works?Well,
given you need to preserve
both the "old"
enum
( the one without "d
" ) orderingand the alphabetical-order too
only one thing is sure - you cannot use
enum
as proposed above for that.MQL4 implements
enum
as a syntax sugar for registering "named constants" for the compiler phase, and translates such elements into an ordered enumeration of a new, specific data-type ( not matching other, strong-typed language data-types in compilation phase ).This means, you cannot mix and mangle alphabet ordering and incidentally arranged sequential ordering ( as Hollywood states in trailing titles: "In the order of appearance" ).
So what can one do?
A Rainman solution ( "Go to Holbrook, with Charlie Babbit." ):