I have a small library which I would like to be used with both Qt and non-Qt programs. Basically I want to use QList if the calling program will be using Qt anyway, else I want to use std::list. So I am thinking of using #define-s like:
Qt Code:
#ifdef QT_VERSION #define MYLIST QList #else #include <list> #define MYLIST std::list #endifTo copy to clipboard, switch view to plain text mode
... and then use MYLIST throughout my code. I think it is safe to assume for practical purposes that if QT_VERSION is defined, Qt is being used? Is this OK? I want to know what is the accepted/conventional of testing whether Qt is being used.
In relation, if a program uses Qt, does it mean it also uses std::list anyway? I'm asking since QList seems to have facilities to convert to and from std::list which may not be possible if std::list is not used somewhere inside Qt?
Bookmarks