问题是我想将一个多集迭代器初始化为某个值,以便稍后检查是否有一些成功分配给我的迭代器。现在在我的程序的某个周期中没有这个初始化,我会得到一些垃圾和所有崩溃。在伪代码中,我会这样想:
multiset<whateverclassA,whateverclassB>::const_iterator init_me = NULL;
...//if succesfull, something is assigned to init_me iterator
if (init_me != NULL)
//do something
但是它不是一个常用的指针,所以简单的 NULL 可能还不够。任何帮助表示赞赏!