Skip to content

Commit

Permalink
Fixed compilation with Sun Studio 12 (avoid usage of std::distance)
Browse files Browse the repository at this point in the history
  • Loading branch information
blep committed Nov 24, 2009
1 parent a1d6c9e commit 56c0401
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/lib_json/json_valueiterator.inl
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,18 @@ ValueIteratorBase::computeDistance( const SelfType &other ) const
{
return 0;
}
return difference_type( std::distance( current_, other.current_ ) );


// Usage of std::distance is not portable (does not compile with Sun Studio 12 RogueWave STL,
// which is the one used by default).
// Using a portable hand-made version for non random iterator instead:
// return difference_type( std::distance( current_, other.current_ ) );
difference_type myDistance = 0;
for ( Value::ObjectValues::iterator it = current_; it != other.current_; ++it )
{
++myDistance;
}
return myDistance;
# endif
#else
if ( isArray_ )
Expand Down

0 comments on commit 56c0401

Please sign in to comment.