program files (x86)\microsoft visual studio 14.0\vc\include\xtree,如果没有找到,下标溢出了,就报错咯

 

---------------------------
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;
}

posted @   txwtech  阅读(692)  评论(0编辑  收藏  举报
编辑推荐:
· 基于Microsoft.Extensions.AI核心库实现RAG应用
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· 开发者必知的日志记录最佳实践
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
阅读排行:
· 震惊!C++程序真的从main开始吗?99%的程序员都答错了
· 别再用vector<bool>了!Google高级工程师:这可能是STL最大的设计失误
· 单元测试从入门到精通
· 【硬核科普】Trae如何「偷看」你的代码?零基础破解AI编程运行原理
· 上周热点回顾(3.3-3.9)
点击右上角即可分享
微信分享提示