webForumDet fria alternativet

Problem med templates och list

0 svar · 286 visningar · startad av Viktor

ViktorMedlem sedan aug. 20021 752 inlägg
#1

Jag har en lista som jag vill spara mina egna smarta pekare till klassen CActionBase i, såhär ser koden ut,

#include "screenobject.hpp"
#include "vgptr.hpp"
#include "actionbase.hpp"
#include "actionhelp.hpp"

#include <list>
#include <algorithm>
#include <iterator>
#include <functional>

namespace vwf
{
	class CActive : public CScreenObject
	{
	private:
		void Handle(CVGPtr<CActionBase> action, Event event);
	protected:
		CActive(void);

		list<CVGPtr<CActionBase> > m_Actions;
		list<CVGPtr<CActionBase> >::iterator m_ActionIter;
	public:
		static CVGPtr<CActive> create();

		virtual bool HandleEvent(Event event, CVGPtr<CScreenObject> scrObj);
		virtual void AddAction(CVGPtr<CActionBase> action);
		virtual void RemoveAction(CVGPtr<CActionBase> action);

		virtual ~CActive(void);
	};
}

och när jag försöker kompilera koden får jag följande fel (gcc 3.4.2),

In file included from src/active.cpp:1:
/home/viktor/dev/dsv/cpp/vwf/framework/include/active.hpp:22: error: ISO C++ forbids declaration of `list' with no type
/home/viktor/dev/dsv/cpp/vwf/framework/include/active.hpp:22: error: expected `;' before '<' token
/home/viktor/dev/dsv/cpp/vwf/framework/include/active.hpp:23: error: ISO C++ forbids declaration of `list' with no type
/home/viktor/dev/dsv/cpp/vwf/framework/include/active.hpp:23: error: expected `;' before '<' token

Observera att den inte klagar på raden

void Handle(CVGPtr<CActionBase> action, Event event);

som använder samma typ av CVGPtr.

/Viktor

123 ms totalt · 3 externa anrop · v20260731065814-full.30151723
0 ms — hämta forumlista (cache)
0 ms — hämta statistik (cache)
120 ms — hämta tråd, inlägg och bilagor (db)