Static set member.

Young, Michael Michael.Young@paetec.com
Tue Aug 29 22:13:00 GMT 2006


In ThingManager, you have a thingSet member, not a thingList.  Your function definitions reference a "thingList", which is not defined.

-----Original Message-----
From: gcc-help-owner@gcc.gnu.org [mailto:gcc-help-owner@gcc.gnu.org]On
Behalf Of Smith-Rowland, Edward M
Sent: Tuesday, August 29, 2006 5:17 PM
To: gcc-help@gcc.gnu.org
Subject: Static set member.


All,

I am attempting to create a singleton class something like this:

class ThingManager
{

    static void show( Thing * thng );
    static void hide( Thing * thng );
    static void hideAll( void );

private:

    static std::set<Thing *,ThingComp> thingSet;
};

I get these errors:
[ed@localhost ~]$ g++ thing.cpp
thing.cpp: In static member function `static void ThingManager::show(Thing*)':
thing.cpp:7: error: `thingList' was not declared in this scope
thing.cpp: In static member function `static void ThingManager::hide(Thing*)':
thing.cpp:13: error: `thingList' was not declared in this scope
thing.cpp: In static member function `static void ThingManager::hideAll()':
thing.cpp:19: error: `thingList' was not declared in this scope

More details (still simple) in the attached files.

What am I doing wrong???

Adding a constructor or initializer to the cpp file is an error:
std::set<Thing *,ThingComp> ThingManager::thingSet();

Ed



More information about the Gcc-help mailing list