Создание карты STL - PullRequest
       6

Создание карты STL

1 голос
/ 16 августа 2011

имеет следующий код:

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;

и получил следующий

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 Ответ

9 голосов
/ 16 августа 2011

Возможно, вы пропустили #include <string>, и именно здесь должно быть объявлено пропущенное operator<.

Некоторые из заголовков MSVC включают в себя прямое объявление std :: string, но на самом деле не включают <string> сама.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...