【发布时间】:2014-04-27 03:17:59
【问题描述】:
我正在尝试找到 2 个字符串之间的交集。我正在使用以下代码:
std::string a = "asd", b = "afd";
std::string intersect;
std::set_intersection(a.begin(), a.end(), b.begin(), b.end(), std::back_inserter(intersect));
它编译成功,但运行程序后立即崩溃并出现以下错误:
任何建议是什么导致了这个问题?
【问题讨论】:
-
错误信息告诉你——set_intersection 的输入需要排序。
标签: c++ crash std intersection