пытаюсь сделать шаблон, но у меня ошибка в gcc4, а не в VS2008.Это код, который завершается ошибкой:
#pragma once
#ifndef _ZELESTE_ZEL_GPX_GENERALMANAGER_H_
#define _ZELESTE_ZEL_GPX_GENERALMANAGER_H_
#include "../internal/cuCoreLib.h"
#include "boost/functional/hash.hpp"
#include "boost/ptr_container/ptr_map.hpp"
namespace z3d{
namespace core{
template<class Key, class Value>
class cuManager
{
boost::ptr_map<Key, Value> m_ItemMap;
public:
/**
* Default constructor
*/
cuManager(void){}
/**
* Get a vector that contain the keys of the elements contained in the manager.
* @return an const std::vector of type Key
*/
const std::vector<Key> getKeys()
{
boost::ptr_map<Key,Value>::iterator itr = m_ItemMap.begin();
std::vector<Key> v;
while(itr != m_ItemMap.end())
{
v.push_back(itr->first);
++itr;
}
return v;
}
}
};
};
Это один из методов, который не удается скомпилировать (все методы класса не выполняются в одном итераторе).Этот код прекрасно работает в Visual Studio, но компиляция в GCC возвращает эту ошибку:
/home/dev001/desarrollo/code/lpgameengine/LPGameEngine/src/core/datatypes/cuManager.h: In member function ‘const std::vector<_Tp, std::allocator<_CharT> > z3d::core::cuManager<Key, Value>::getKeys()’:
/home/dev001/desarrollo/code/lpgameengine/LPGameEngine/src/core/datatypes/cuManager.h:28: error: expected ‘;’ before ‘itr’
/home/dev001/desarrollo/code/lpgameengine/LPGameEngine/src/core/datatypes/cuManager.h:30: error: ‘itr’ was not declared in this scope
Любая помощь будет приветствоваться