[Vala] comparison method for standard types?



I'm trying to build a generic class that needs to do comparisons among it's elements. For this I need some way of comparing the elements, which I can do for custom classes, but is there some standard way to do this for the built-in classes?

If I use string as the element being compared, I could build the comparison around the read-only property uint8[] data (though I'd prefer a less used name, as this would mean that THAT is what I'd need to use the property for in all generic parameters that could be used). Unfortunately, this doesn't look like it would work for numeric types.

N.B.: For my purposes I only want to compare one instance with something else of the exact same type, but I do want to be able to put it into a useful ordering.

Possibly this should be obvious, but I'm just getting started with Vala, and I'm not finding it obvious (without requiring that all generic parameters implement some particular interface...and I can't even see how to apply that restriction).




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]