Compare enum naturally

I’m really getting tired of this:

enum <int32> Ver
{
    test1= -1,
    test2= 0,
    test3 = 1,

};

// somewhere in the code when comparing
if (reference.Version >= -1)

I tried every damn way like you would expect in any other language to write a natural comparison like:

if (enumval == Enum.Definition)

but it just does not work. Why can’t we have nice things?

In C/C++, when you make an enum each of the constants becomes available in global scope. You should be able to do something like this to compare:

enum <int32> Ver
{
    test1= -1,
    test2= 0,
    test3 = 1,
};

Ver version;
if( version >= test1 )
{
    
}

Are you trying to do something different?

Graeme
SweetScape Software