[Development] Adding support for version number comparisons

André Somers andre at familiesomers.nl
Wed May 14 16:05:20 CEST 2014


Keith Gardner schreef op 14-5-2014 15:45:
>
>     Well, if you use a virtual, you'd simply subclass to handle the
>     specific format for your project.
>
> I haven't thought about using inheritance to simplify the compare but 
> I think that would provide the best compromise.  What are your 
> thoughts about comparing a QVersion to a QSpecializedVersion or a 
> QSpecialized1Version to a QSpecialized2Version since both would have 
> different isNonNumericalSectionLessThan functions?
>
Good one, I did not consider that. I was simply proposing my ideal color 
for the bike shed ;-).

I think they should not compare at all. Not sure what the best way to 
ensure that would be though. Otherwise, you'd end up with the situaton 
that QVersion < QSpecilializedVersion but not QSpecializedVersion > 
QVersion due to which instances compare function was used. Or, if it is 
not easy to prevent that from happening without cluttering the API, you 
simply clearly document that the result of comparing two different 
QVersion specializations is undefined.

André

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/development/attachments/20140514/e9fe3034/attachment.html>


More information about the Development mailing list