MCPcopy Create free account
hub / github.com/Illumina/paragraph / computeDistance

Method computeDistance

external/jsoncpp/jsoncpp.cpp:2326–2352  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 1

operator-Function · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected