---------------------------
Microsoft Visual C++ Runtime Library
---------------------------
Debug Assertion Failed!

Program: C:\Windows\SYSTEM32\MSVCP140D.dll
File: d:\program files (x86)\microsoft visual studio 14.0\vc\include\xtree
Line: 238

Expression: map/set iterator not dereferencable

For information on how your program can cause an assertion
failure, see the Visual C++ documentation on asserts.

(Press Retry to debug the application)

---------------------------
中止(A) 重试(R) 忽略(I)
---------------------------

 

int main()
{
//set<string> names;//不写,是默认的二元谓词,区分大小写
set<string,CCompareStringNoCase> names;//不区分大小写,二元谓词可以改变容器的默认的行为
//cout << "hello" << endl;
names.insert("Tina");
names.insert("jim");
names.insert("Jack");
names.insert("Sam");
names.insert("hello");
//set<string>::iterator iNameFound = names.find("Jim");
set<string,CCompareStringNoCase>::iterator iNameFound = names.find("1im");
if (iNameFound != names.end())
{
cout << "找到了。。。" << *iNameFound << endl;
}
else
{
cout << "没找到。。。" << endl;
//cout << "没找到。。。" << *iNameFound << endl;//----------------------------如果没有找到,下标溢出了,就报错咯
}
getchar();
return 0;
}

相关文章:

  • 2021-04-22
  • 2022-12-23
  • 2022-03-10
  • 2022-01-20
  • 2022-01-08
  • 2021-06-05
  • 2021-08-27
  • 2022-12-23
猜你喜欢
  • 2021-06-22
  • 2021-05-04
  • 2022-02-05
  • 2021-11-22
  • 2022-12-23
  • 2021-07-01
  • 2021-12-12
相关资源
相似解决方案