D
Daniel Wilson
I have an enumerated type like this:
public __value enum MyType{
ABC = 1,
DEF = 2,
GHI = 3,
JKL = 4
};
Later I have a for loop like this:
for (ft = MyType::ABC; ft <= MyType::JKL; ft++){
//Do stuff
}
I then get a compile error C2676: binary '++': 'MyType' does not define this
operator or a converstion to a type acceptable to the predefined operator.
So I tried to define the ++ operator.
MyType operator++(MyType &ft, int){
return ft = (MyType)(ft+1);
}
That gives me compile error C3281: 'operator` ++": global operator cannot
have managed type 'MyType __gc &' in signature.
So my question: How do I get a managed enumerated type to allow me to use
the ++ operator to iterate through its values?
dwilson
public __value enum MyType{
ABC = 1,
DEF = 2,
GHI = 3,
JKL = 4
};
Later I have a for loop like this:
for (ft = MyType::ABC; ft <= MyType::JKL; ft++){
//Do stuff
}
I then get a compile error C2676: binary '++': 'MyType' does not define this
operator or a converstion to a type acceptable to the predefined operator.
So I tried to define the ++ operator.
MyType operator++(MyType &ft, int){
return ft = (MyType)(ft+1);
}
That gives me compile error C3281: 'operator` ++": global operator cannot
have managed type 'MyType __gc &' in signature.
So my question: How do I get a managed enumerated type to allow me to use
the ++ operator to iterate through its values?
dwilson