>>3
An iterator isn't an int nor a pointer, and there isn't any implicit conversion between these types. "Null pointer" isn't an iterator.
Try making it
std::vector<Idea>::iterator find_idea_id(const unsigned long int& idea_id, std::vector<Idea>::iterator& it = std::vector<Idea>::iterator() ) const;. Not sure if that'll compile but it makes a bit more sense anyway.
In the worst case you could write two functions with a different signature instead:
std::vector<Idea>::iterator find_idea_id(const unsigned long int& idea_id ) const;
std::vector<Idea>::iterator find_idea_id(const unsigned long int& idea_id, std::vector<Idea>::iterator& it) const;
and implement the first one as
find_idea_id(const unsigned long int& idea_id) {
return find_idea_id(idea_id, idea_registry_.begin() ); // or whatever
}
I don't really get what you want to do in the first place though. What's the point of the iterator argument? And stuff like
unsigned long int& get_idea_id(); or
const unsigned long int& is useless, it's a crappy int, just take it as a non-const non-reference argument like a man. Performance will be identical. I guarantee it.