[Interest] Proper way of testing whether Qt is being used by a program

Konstantin Tokarev annulen at yandex.ru
Tue Aug 14 13:03:11 CEST 2012

14.08.2012, 14:57, "Shriramana Sharma" <samjnaa at gmail.com>:
> Hello I'm new to this list. I'm an academic of the humanities and use
> Qt now and then via C++ / Python+PyQt in relation with my academic
> projects. I should not I'm *not* a highly experienced advanced
> programmer, but am OK with intermediate stuff.
> 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::deque (which seems to
> be the one with most similar API to QList)

I don't think it's a proper way to go.

1. STL is available in all modern compilers so there's no practival reason to avoid it
2. You may want to use templates to let user of your library choose container.
3. If you still want to switch them by #ifdef, you should consider using custom define
passed by user or configuration option of your library.


More information about the Interest mailing list