| 2238 | void ValueIteratorBase::decrement() { --current_; } |
| 2239 | |
| 2240 | ValueIteratorBase::difference_type |
| 2241 | ValueIteratorBase::computeDistance(const SelfType &other) const { |
| 2242 | #ifdef JSON_USE_CPPTL_SMALLMAP |
| 2243 | return other.current_ - current_; |
| 2244 | #else |
| 2245 | // Iterator for null value are initialized using the default |
| 2246 | // constructor, which initialize current_ to the default |
| 2247 | // std::map::iterator. As begin() and end() are two instance |
| 2248 | // of the default std::map::iterator, they can not be compared. |
| 2249 | // To allow this, we handle this comparison specifically. |
| 2250 | if (isNull_ && other.isNull_) { |
| 2251 | return 0; |
| 2252 | } |
| 2253 | |
| 2254 | // Usage of std::distance is not portable (does not compile with Sun Studio 12 |
| 2255 | // RogueWave STL, |
| 2256 | // which is the one used by default). |
| 2257 | // Using a portable hand-made version for non random iterator instead: |
| 2258 | // return difference_type( std::distance( current_, other.current_ ) ); |
| 2259 | difference_type myDistance = 0; |
| 2260 | for (Value::ObjectValues::iterator it = current_; it != other.current_; |
| 2261 | ++it) { |
| 2262 | ++myDistance; |
| 2263 | } |
| 2264 | return myDistance; |
| 2265 | #endif |
| 2266 | } |
| 2267 | |
| 2268 | bool ValueIteratorBase::isEqual(const SelfType &other) const { |
| 2269 | if (isNull_) { |