MCPcopy Create free account
hub / github.com/PlayFab/gsdk / computeDistance

Method computeDistance

cpp/cppsdk/jsoncpp.cpp:2318–2344  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2316}
2317
2318ValueIteratorBase::difference_type
2319ValueIteratorBase::computeDistance(const SelfType& other) const {
2320#ifdef JSON_USE_CPPTL_SMALLMAP
2321 return other.current_ - current_;
2322#else
2323 // Iterator for null value are initialized using the default
2324 // constructor, which initialize current_ to the default
2325 // std::map::iterator. As begin() and end() are two instance
2326 // of the default std::map::iterator, they can not be compared.
2327 // To allow this, we handle this comparison specifically.
2328 if (isNull_ && other.isNull_) {
2329 return 0;
2330 }
2331
2332 // Usage of std::distance is not portable (does not compile with Sun Studio 12
2333 // RogueWave STL,
2334 // which is the one used by default).
2335 // Using a portable hand-made version for non random iterator instead:
2336 // return difference_type( std::distance( current_, other.current_ ) );
2337 difference_type myDistance = 0;
2338 for (Value::ObjectValues::iterator it = current_; it != other.current_;
2339 ++it) {
2340 ++myDistance;
2341 }
2342 return myDistance;
2343#endif
2344}
2345
2346bool ValueIteratorBase::isEqual(const SelfType& other) const {
2347 if (isNull_) {

Callers 1

operator-Function · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected