以下のように挿入できないのはなぜですか?C++マップはペアで挿入できません
#include <map>
struct something {
} some_object;
typedef std::map<std::string, something*> list;
typedef std::pair<std::string, something*> pair;
int main()
{
list l;
pair p("abc", &some_object); // working fine!!!
l.insert(p); // 17 errors
return 0;
}
ビジュアルスタジオは私に多くのエラーをもたらし、私はそれらの何かを理解しません。最初の1つは:
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'
私はもっと投稿できますが、私はここにスパムしたくありません。あなたの助けに感謝します。あなたは実装の詳細に中継されている
typedef std::pair<std::string, something*> pair;
:
あなたは私のペットの憎しみに「can not」ではなく「cant」を使用してヒットしました。 "cant"はそれ自体の言葉であり、できないものとは全く異なる意味を持っています:http://dictionary.reference.com/browse/cant –