hi,
How do I create an enum list of values to show up as a dropdown list in a function's parameter list?
Printable View
hi,
How do I create an enum list of values to show up as a dropdown list in a function's parameter list?
No idea if this will trigger the IntelliSense or not (I use VC++5) but I'd expect it to:Code:enum days {
monday,
tuesday,
wednesday,
thursday,
friday,
saturday,
sunday
};
void myfunction(days d, int *i) {
*i = d;
}
It doesnt. Remember your values =P.
Z.
Which values?
You don't need to give them in C++ enums - they start from 0 and go up.
No, remember what values your enum can have =).
Z.
0 to 6 I would have expected...
...I don't totally understand what you mean.
Im saying "dont rely on intellisense". Keep the possible enum values in your head =). For example, using the days enum, just remember that the possible values are sunday, monday, tuesday, wednesday, thursday, friday, or saturday.
Z.
I do that anyway :)
I've been doing that for the past 5 or 6 years, since the days of C, when I learnt on BBC :p