[Development] Single static list object to track something

Majid Khan mkhan3189 at gmail.com
Fri Sep 21 01:08:59 CEST 2012


Hi,

I have a class that tracks strings so essentially TrackedStrings :
QStringList and this contains a list of strings that are being tracked (so
some function from some other class calls it's add(const QString& string).
I need this object as static because I want to access it from anywhere
without having to define it.

Now everytime TrackedStrings.h header is used, it initializes it even
though I have used prevent guard (I checked it by having a break point on
constructer).

What is the best way to use this static TrackedStrings trackedStrings;
object in order to use it from anywhere. Remember, I don't want to
explicitly initialize it (on heap or stack).

Thanks

-- 
Majid Khan
http://www.icplusplus.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/development/attachments/20120921/584d8d4e/attachment.html>


More information about the Development mailing list