0

WORKS:

LLGroupMgrGroupData* LLGroupMgr::getGroupData(const LLUUID& id)
{
	group_map_t::iterator gi = mGroups.find(id);

	if (gi != mGroups.end())
	{
		return gi->second;
	}
	return NULL;
}

DOESN'T WORK:

// static
LLGroupMgrGroupData* LLGroupMgr::getStaticGroupData(const LLUUID& id)
{
	group_map_t::iterator gi = mGroups.find(id);

	if (gi != mGroups.end())
	{
		return gi->second;
	}
	return NULL;
}

Error 1 error C2228: left of '.find' must have class/struct/union
Error 2 error C2228: left of '.end' must have class/struct/union

i get those errors only on the second part, the only diffrences is that the second one is static...

here is the header file:

class LLGroupMgr : public LLSingleton<LLGroupMgr>
{
public:
	LLGroupMgr();
	~LLGroupMgr();

	LLGroupMgrGroupData* getGroupData(const LLUUID& id);
	static LLGroupMgrGroupData* getStaticGroupData(const LLUUID& id);

private:
	typedef std::map<LLUUID, LLGroupMgrGroupData*> group_map_t;
	group_map_t mGroups;
	
};

Please help me solving this out im going crazy !

3
Contributors
2
Replies
4
Views
7 Years
Discussion Span
Last Post by neil.a.hudson
0

I don't know why you are getting this error, I would expect something like 'invalid use of non-static member in static function' error over here. Since getStaticGroupData is a static function of the class and mGroups is a non-static member of the same class and you are not allowed to access non-static members in a static function.

0

Probably not of interest to the originator after 2 years but answered for anyone else who hits this. It is because mGroups is not static (and hence should not be accessible from the static method). Make mGroups static and this error should go away. Just made a similar mistake myself.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.