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é

_______________________________________________
Development mailing list
Development@qt-project.org
http://lists.qt-project.org/mailman/listinfo/development

Reply via email to