This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
RE: Static set member.
- From: "Young, Michael" <Michael dot Young at paetec dot com>
- To: "Smith-Rowland, Edward M" <ESmith-rowland at alionscience dot com>, <gcc-help at gcc dot gnu dot org>
- Date: Tue, 29 Aug 2006 17:37:35 -0400
- Subject: RE: Static set member.
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