C++ STL映射实例化

C++ STL映射实例化,c++,stl,C++,Stl,有下一个代码: class GameTexture { private: LPDIRECT3DTEXTURE9 texture; unsigned char *alphaLayer; UINT width, height; GameTexture() {}; GameTexture(const GameTexture&) {} public: static GameTexture *CreateTexture(LPCTSTR pSrcFile, LPDIRECT3DDEVICE9 d

有下一个代码:

class GameTexture
{
private:
LPDIRECT3DTEXTURE9 texture;
unsigned char *alphaLayer;
UINT width, height;

GameTexture() {};
GameTexture(const GameTexture&) {}
public:
static GameTexture *CreateTexture(LPCTSTR  pSrcFile, LPDIRECT3DDEVICE9 d3dDevice);

~GameTexture();
};

class TexturesPool
{
private:
map<string, GameTexture*> textures;
class游戏纹理
{
私人:
LPDIRECT3DTEXTURE9纹理;
无符号字符*字母层;
单元宽度、高度;
GameTexture(){};
GameTexture(const GameTexture&){}
公众:
静态游戏纹理*创建纹理(LPCTSTR pSrcFile,LPDIRECT3DDEVICE9 d3dDevice);
~GameTexture();
};
类TexturePool
{
私人:
贴图纹理;
接下来呢

1>c:\program files\microsoft visual studio 10.0\vc\include\xfunctional(125): error C2784: 'bool std::operator <(const std::_Tree<_Traits> &,const std::_Tree<_Traits> &)' : could not deduce template argument for 'const std::_Tree<_Traits> &' from 'const std::string'
1>          c:\program files\microsoft visual studio 10.0\vc\include\xtree(1885) : see declaration of 'std::operator <'
1>          c:\program files\microsoft visual studio 10.0\vc\include\xfunctional(124) : while compiling class template member function 'bool std::less<_Ty>::operator ()(const _Ty &,const _Ty &) const'
1>          with
1>          [
1>              _Ty=std::string
1>          ]
1>          c:\program files\microsoft visual studio 10.0\vc\include\map(71) : see reference to class template instantiation 'std::less<_Ty>' being compiled
1>          with
1>          [
1>              _Ty=std::string
1>          ]
............

1>c:\program files\microsoft visual studio 10.0\vc\include\xfunctional(125):错误C2784:'bool std::operator您可能缺少
#include
,这就是缺少的
operator摘要/问题的可能来源>?这是因为在map中使用GameTexture*,如果替换为int一切正常,但我需要使用指向我的对象的指针的map。粘贴的代码是正确的y源于对纹理变量的错误使用,请查看编译器输出,粘贴错误旁边。请在问题中使用实际句子好吗?作为对代码的轻微改进,我建议您使用shared/unique_ptr,而不是在容器中保留原始指针。