Can I return Null iterator from a function
问题 I'm porting some old code from vs6.0 to vs2015. A function is returning a Null iterator; the caller compares it with NULL , which works in vs6.0, but in vs2015 that's an error. Is it possible that we can return a null iterator? The old code looks something like this: vector<string*>::iterator FindByCode() { //some code if (itr == str.end) { return NULL; } else { return itr; } } int main() { vector<string*>::iterator itr = FindByCode(); if (itr == NULL) { return EXIT_FAILURE; } } 来源: https:/