我正在使用以下代码
void SomeClass::Update(const std::string& symbol, const int& volume)
{
std::map<std::string,int>& Refcontainer = BTracker;
//The two conditionals below seem to cause a problem here
if(Refcontainer.find(symbol) != Refcontainer.end())
{
Refcontainer[symbol] = Refcontainer[symbol] + volume;
}
else
{
Refcontainer[symbol] = 0 + volume;
}
}
我得到的错误是:
Error 16 error C2676: binary '<' : 'const std::string' does not define this operator or a conversion to a type acceptable to the predefined operator c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xfunctional 125 1 " "
Error 10 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::string' c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xfunctional 125 1 " "
Error 11 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::string' c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xfunctional 125 1 " "
Error 12 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::string' c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xfunctional 125 1 " "
Error 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' c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xfunctional 125 1 " "
Error 2 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' c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xfunctional 125 1 " "
Error 3 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' c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xfunctional 125 1 " "
Error 13 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::string' c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xfunctional 125 1 " "
Error 14 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::string' c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xfunctional 125 1 " "
Error 15 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::string' c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xfunctional 125 1 " "
Error 7 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::string' c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xfunctional 125 1 " "
Error 8 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::string' c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xfunctional 125 1 " "
Error 9 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::string' c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xfunctional 125 1 " "
Error 4 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::string' c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xfunctional 125 1 " "
Error 5 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::string' c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xfunctional 125 1 " "
Error 6 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::string' c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xfunctional 125 1 " "
关于为什么我收到此错误以及如何解决它的任何建议?