-
Type:
Task
-
Resolution: Unresolved
-
Priority:
Minor - P4
-
None
-
Affects Version/s: None
-
Component/s: None
-
Server Programmability
-
None
-
None
-
None
-
None
-
None
-
None
-
None
https://jira.mongodb.org/browse/SERVER-97413
We should change the BSONObjStlIterator type to be a C++20-range style range rather than an older style. This gives us two benefits:
end() is allowed to return a different type (a sentinel), so operator== knows when it is doing an end check, and can do >= like BSONObj, rather than ==. This ensures that if we somehow end up past the end we exit the loop rather than continuing forever. Alternatively, we could throw in the > case, since something is very wrong if we get there.
operator* doesn't need to return a `T&`, so we can return a BSONElement by value rather than storing one as a member. This gives us more flexibility in how we represent the data in the iterator.