を行うにはどのように私は次のコードを持っている:マップ - それを
std::map<std::wstring, std::vector<Table> > my_map;
my_map[L"abc"].push_back(Table());
が、それをコンパイルしようとしているが、それは私が全く理解していないこれは、エラー{MSVC 2010}の多くを提供します。
したがって、修辞的な質問の1つ:なぜMSは人々が理解できないエラーの束を与えているのですか?そして2番目:2行目の修正方法は?
ありがとうございます。ここで
は、参考のためにエラーです:
2>c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xfunctional(125): error C2784: 'bool std::operator <(const std::vector<_Ty,_Ax> &,const std::vector<_Ty,_Ax> &)' : could not deduce template argument for 'const std::vector<_Ty,_Ax> &' from 'const std::wstring'
2> c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\vector(1502) : see declaration of 'std::operator <'
2> c:\Program Files (x86)\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'
2> with
2> [
2> _Ty=std::wstring
2> ]
2> c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\map(71) : see reference to class template instantiation 'std::less<_Ty>' being compiled
2> with
2> [
2> _Ty=std::wstring
2> ]
2> c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xtree(451) : see reference to class template instantiation 'std::_Tmap_traits<_Kty,_Ty,_Pr,_Alloc,_Mfl>' being compiled
2> with
2> [
2> _Kty=std::wstring,
2> _Ty=std::vector<Table>,
2> _Pr=std::less<std::wstring>,
2> _Alloc=std::allocator<std::pair<const std::wstring,std::vector<Table>>>,
2> _Mfl=false
2> ]
2> c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xtree(520) : see reference to class template instantiation 'std::_Tree_nod<_Traits>' being compiled
2> with
2> [
2> _Traits=std::_Tmap_traits<std::wstring,std::vector<Table>,std::less<std::wstring>,std::allocator<std::pair<const std::wstring,std::vector<Table>>>,false>
2> ]
2> c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xtree(659) : see reference to class template instantiation 'std::_Tree_val<_Traits>' being compiled
2> with
2> [
2> _Traits=std::_Tmap_traits<std::wstring,std::vector<Table>,std::less<std::wstring>,std::allocator<std::pair<const std::wstring,std::vector<Table>>>,false>
2> ]
2> c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\map(81) : see reference to class template instantiation 'std::_Tree<_Traits>' being compiled
2> with
2> [
2> _Traits=std::_Tmap_traits<std::wstring,std::vector<Table>,std::less<std::wstring>,std::allocator<std::pair<const std::wstring,std::vector<Table>>>,false>
2> ]
2> C:\Users\Igor\OneDrive\Documents\dbhandler_app\dbinterface\database.h(115) : see reference to class template instantiation 'std::map<_Kty,_Ty>' being compiled
2> with
2> [
2> _Kty=std::wstring,
2> _Ty=std::vector<Table>
2> ]
2>c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xfunctional(125): error C2784: 'bool std::operator <(const std::vector<_Ty,_Ax> &,const std::vector<_Ty,_Ax> &)' : could not deduce template argument for 'const std::vector<_Ty,_Ax> &' from 'const std::wstring'
2> c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\vector(1502) : see declaration of 'std::operator <'
2>c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xfunctional(125): error C2784: 'bool std::operator <(const std::vector<_Ty,_Ax> &,const std::vector<_Ty,_Ax> &)' : could not deduce template argument for 'const std::vector<_Ty,_Ax> &' from 'const std::wstring'
2> c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\vector(1502) : see declaration of 'std::operator <'
2>c:\Program Files (x86)\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::wstring'
2> c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xtree(1885) : see declaration of 'std::operator <'
2>c:\Program Files (x86)\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::wstring'
2> c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xtree(1885) : see declaration of 'std::operator <'
2>c:\Program Files (x86)\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::wstring'
2> c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xtree(1885) : see declaration of 'std::operator <'
2>c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xfunctional(125): error C2784: 'bool std::operator <(const std::unique_ptr<_Ty,_Dx> &,const std::unique_ptr<_Ty2,_Dx2> &)' : could not deduce template argument for 'const std::unique_ptr<_Ty,_Dx> &' from 'const std::wstring'
2> c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\memory(2582) : see declaration of 'std::operator <'
2>c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xfunctional(125): error C2784: 'bool std::operator <(const std::unique_ptr<_Ty,_Dx> &,const std::unique_ptr<_Ty2,_Dx2> &)' : could not deduce template argument for 'const std::unique_ptr<_Ty,_Dx> &' from 'const std::wstring'
2> c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\memory(2582) : see declaration of 'std::operator <'
2>c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xfunctional(125): error C2784: 'bool std::operator <(const std::unique_ptr<_Ty,_Dx> &,const std::unique_ptr<_Ty2,_Dx2> &)' : could not deduce template argument for 'const std::unique_ptr<_Ty,_Dx> &' from 'const std::wstring'
2> c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\memory(2582) : see declaration of 'std::operator <'
2>c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xfunctional(125): error C2784: 'bool std::operator <(const std::reverse_iterator<_RanIt> &,const std::reverse_iterator<_RanIt2> &)' : could not deduce template argument for 'const std::reverse_iterator<_RanIt> &' from 'const std::wstring'
2> c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xutility(1356) : see declaration of 'std::operator <'
2>c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xfunctional(125): error C2784: 'bool std::operator <(const std::reverse_iterator<_RanIt> &,const std::reverse_iterator<_RanIt2> &)' : could not deduce template argument for 'const std::reverse_iterator<_RanIt> &' from 'const std::wstring'
2> c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xutility(1356) : see declaration of 'std::operator <'
2>c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xfunctional(125): error C2784: 'bool std::operator <(const std::reverse_iterator<_RanIt> &,const std::reverse_iterator<_RanIt2> &)' : could not deduce template argument for 'const std::reverse_iterator<_RanIt> &' from 'const std::wstring'
2> c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xutility(1356) : see declaration of 'std::operator <'
2>c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xfunctional(125): error C2784: 'bool std::operator <(const std::_Revranit<_RanIt,_Base> &,const std::_Revranit<_RanIt2,_Base2> &)' : could not deduce template argument for 'const std::_Revranit<_RanIt,_Base> &' from 'const std::wstring'
2> c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xutility(1179) : see declaration of 'std::operator <'
2>c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xfunctional(125): error C2784: 'bool std::operator <(const std::_Revranit<_RanIt,_Base> &,const std::_Revranit<_RanIt2,_Base2> &)' : could not deduce template argument for 'const std::_Revranit<_RanIt,_Base> &' from 'const std::wstring'
2> c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xutility(1179) : see declaration of 'std::operator <'
2>c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xfunctional(125): error C2784: 'bool std::operator <(const std::_Revranit<_RanIt,_Base> &,const std::_Revranit<_RanIt2,_Base2> &)' : could not deduce template argument for 'const std::_Revranit<_RanIt,_Base> &' from 'const std::wstring'
2> c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xutility(1179) : see declaration of 'std::operator <'
2>c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xfunctional(125): error C2784: 'bool std::operator <(const std::pair<_Ty1,_Ty2> &,const std::pair<_Ty1,_Ty2> &)' : could not deduce template argument for 'const std::pair<_Ty1,_Ty2> &' from 'const std::wstring'
2> c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\utility(318) : see declaration of 'std::operator <'
2>c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xfunctional(125): error C2784: 'bool std::operator <(const std::pair<_Ty1,_Ty2> &,const std::pair<_Ty1,_Ty2> &)' : could not deduce template argument for 'const std::pair<_Ty1,_Ty2> &' from 'const std::wstring'
2> c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\utility(318) : see declaration of 'std::operator <'
2>c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xfunctional(125): error C2784: 'bool std::operator <(const std::pair<_Ty1,_Ty2> &,const std::pair<_Ty1,_Ty2> &)' : could not deduce template argument for 'const std::pair<_Ty1,_Ty2> &' from 'const std::wstring'
2> c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\utility(318) : see declaration of 'std::operator <'
2>c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xfunctional(125): error C2676: binary '<' : 'const std::wstring' does not define this operator or a conversion to a type acceptable to the predefined operator
'vector'と' map'をインクルードしましたか? – Rakete1111
http://stackoverflow.com/help/mcve –
マイクロソフトのコンパイラは、解読不可能なエラーメッセージの大量の髪の毛であなたを埋葬するためのすべての言い訳をする唯一のC++コンパイラではありません。 –